[Python-ideas] duck typing for io write methods

Paul Moore p.f.moore at gmail.com
Sat Jun 15 19:12:59 CEST 2013


On 15 June 2013 17:51, Wolfgang Maier <
wolfgang.maier at biologie.uni-freiburg.de> wrote:

> So if I understand the PEP correctly, then, theoretically, text mode file
> IO
> objects could be implemented to declare that all they'll ever need is 1
> byte
> strings (if the encoding is ASCII-compatible)?
>

There's no need to "declare" anything - if the file does not contain code
points outside the 1-byte range, it just works. No declaration needed.

The changes in the PEP are entirely transparent to the user, they just
magically make your code faster if possible :-)
Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130615/adbd8215/attachment.html>


More information about the Python-ideas mailing list