What is file.encoding convention?
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Tue Jul 28 02:45:52 EDT 2009
En Thu, 23 Jul 2009 21:49:26 -0300, Naoki INADA <songofacandy at gmail.com>
escribió:
>>> The encoding that this file uses. When Unicode strings are written to
>>> a file,
>>> they will be converted to byte strings using this encoding. In
>>> addition,
>>> when the file is connected to a terminal, the attribute gives the
>>> encoding
>>> that the terminal is likely to use
>
> I feel this doc means "file object with encoding attribute encodes
> unicode
> regardless it is tty or not" and sys.stdout/stderr defies convention.
The 'encoding' file attribute is very confusing and mostly unsupported (or
there is a bug in the documentation, at least in Python 2.x). See
http://bugs.python.org/issue4947
--
Gabriel Genellina
More information about the Python-list
mailing list