memoryview works in both Python 2.7 and Python 3
This commit is contained in:
parent
1655a445d0
commit
4a68a35a4d
@ -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…
Reference in New Issue
Block a user