[Python-3000] Pre-PEP: Easy Text File Decoding

Nick Coghlan ncoghlan at gmail.com
Sun Sep 10 14:05:35 CEST 2006

Paul Prescod wrote:
> The function to open a text file will tenatively be called textfile(), 
> though the function name is not an integral part of this PEP. The 
> function takes three arguments, the filename, the mode ("r", "w", "r+", 
> etc.) and the type.
> The type could be a true encoding or one of a small set of additional 
> symbolic values.

The 'additional symbolic values' should be implemented as true encodings 
(i.e., it should be possible to look up 'site', 'guess' and 'locale' in the 
codecs registry, and replace them there as well).

I also agree with Guido that the right spelling for the factory function is to 
incorporate this into the existing open() builtin. The signature of open() is 
already going to change to accept an encoding argument in Py3k, and the 
special encodings proposed in the PEP are just that: special encodings that 
happen to take environmental information into account when deciding how to 
decode or encode data.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-3000 mailing list