[Python-3000] bytes & Py_TPFLAGS_BASETYPE

Mathieu Fenniak mathieu.fenniak at gmail.com
Mon Sep 17 20:33:18 CEST 2007


On 17-Sep-07, at 11:53 AM, Guido van Rossum wrote:
>> "writeToStream" method that serializes the object -- a byte string
>> would write out <68656c6c6f>, a text string (hello), and so on for
>> other more complex types (dictionaries, labels, arrays, PDF data
>> streams).  The type is also responsible for encrypting itself when
>> applicable.
>
> This sounds like a perfect application for generic functions instead
> of subclassing.

Sure, there are other options for writing and organizing this code.   
But, this is a valid application of subclassing the bytes type, and  
it is the method I would prefer to be able to implement.

Mathieu


More information about the Python-3000 mailing list