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

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/201405281838.15889.shai%40platonix.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to