[Python-Dev] Python 3.0.1 (io-in-c)

Adam Olsen rhamph at gmail.com
Wed Jan 28 20:42:30 CET 2009


On Wed, Jan 28, 2009 at 11:52 AM, Paul Moore <p.f.moore at gmail.com> wrote:
> Ah, I see. That is entirely obvious. The key bit of information is
> that the default io encoding is cp1252, not cp850. I know that in
> theory, I see the consequences often enough (:-)), but it isn't
> "instinctive" for me. And the simple "default encoding is system
> dependent" comment is not very helpful in terms of warning me that
> there could be an issue.
>
> I do think that more wording around encoding defaults would be useful
> - as I said, I'll think about how best it could be made into a doc
> patch. I suspect the best approach would be to have a section (maybe
> in the docs for the codecs module) explaining all the details, and
> then a cross-reference to that from the various places (open, io)
> where default encodings are mentioned.

It'd also help if the file repr gave the encoding:

>>> f = open('/dev/null')
>>> f
<io.TextIOWrapper object at 0x7ff4468d8a90>
>>> import sys
>>> sys.stdout
<io.TextIOWrapper object at 0x7ff4476126d0>

Of course I can check .encoding manually, but it needs to be more intuitive.


-- 
Adam Olsen, aka Rhamphoryncus


More information about the Python-Dev mailing list