python 3, subclassing TextIOWrapper.

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Sun Mar 22 21:27:29 CET 2009


En Sun, 22 Mar 2009 16:37:31 -0300, Benjamin Peterson  
<benjamin at python.org> escribió:
> Gabriel Genellina <gagsl-py2 <at> yahoo.com.ar> writes:
>>
>> There is another alternative that relies on undocumented behaviour: use
>> open to create a *binary* file and wrap the resulting BufferedReader
>> object in your own TextIOWrapper.
>
> How is that undocumented behavior? TextIOWrapper can wrap any buffer  
> which
> follows the io.BufferedIOBase ABC. BufferedReader is a subclass of
> io.BufferedIOBase.

The undocumented behavior is relying on the open() builtin to return a  
BufferedReader for a binary file.

-- 
Gabriel Genellina




More information about the Python-list mailing list