Hi all,
While solving #22715[1], I found myself writing these lines:
elif (isinstance(value, six.memoryview) or
six.PY3 and isinstance(value, bytes)):
....
six.memoryview -- django.utils.six.memoryview, to be accurate, there's no
memoryview in the original six library -- is defined to be `memoryview` on
python3, and `buffer` on python2. But having written this code, I thought the
distinction might have more general value, and so we should maybe add a
"bytes_types" -- similar to six.string_types -- which would be defined as
`buffer` on python2, but `(memoryview, bytes)` on python3. The above would
change to
elif isinstance(value, six.bytes_types):
....
which is obviously nicer.
The question to you is, is it just me? Do you think "bytes_types" can be
useful?
Thanks,
Shai.
[1]
https://code.djangoproject.com/ticket/22715