memoryview works in both Python 2.7 and Python 3

pull/378/head
cclauss 6 years ago committed by GitHub
parent 1655a445d0
commit 4a68a35a4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -9,13 +9,16 @@ except NameError: # Python 3
text_type = str
string_types = (str, )
try:
memoryview # Python 2.7 and Python 3
except NameError:
memoryview = buffer # Python 2.6
if not PY2K:
buffer = memoryview # noqa undefined name 'memoryview' in Python 2.6
filter, map, zip = filter, map, zip
iteritems = lambda dikt: iter(dikt.items()) # noqa: E731
from functools import reduce
else:
buffer = buffer
from itertools import ifilter, imap, izip
filter, map, zip = ifilter, imap, izip
iteritems = lambda dikt: dikt.iteritems() # noqa: E731

Loading…
Cancel
Save