[Python-porting] six.buffer_types?
Shai Berger
shai at platonix.com
Sat Jun 14 00:44:18 CEST 2014
More information about the Python-porting mailing list
Sat Jun 14 00:44:18 CEST 2014
- Previous message: [Python-porting] six.buffer_types?
- Next message: [Python-porting] in-progress work on a pylint checker for 2/3 compat
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Friday 13 June 2014 08:33:46 Benjamin Peterson wrote: > In addition to David said, David suggested that memoryview be considered a buffer type on Python2 as well, and he is correct, of course. I missed it because the Django code that this is, originally, an amendment to, conflates buffer and memoryview on purpose. So, I correct the suggestion: if six.PY2: buffer_types = buffer, bytearray, memoryview if six.PY3: buffer_types = bytes, bytearray, memoryview > usually the correct way to use a buffer type > is to call a buffer type (either memoryview or buffer) on some object > that supports the buffer interface. I'm curious what you're using the > list for. > As I said, for an isinstance check. The context is that I am receiving a value of unknown type, and need to format it for use as the default value of a database table column. If it is binary (buffer) data, it needs to be transformed to a string of hexadecimals. Other data types get different treatments (the data must be formatted, rather than passed as a parameter, because Oracle does not take parameters in schema-changing statements). Thanks, Shai,
- Previous message: [Python-porting] six.buffer_types?
- Next message: [Python-porting] in-progress work on a pylint checker for 2/3 compat
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-porting mailing list