Author nikratio
Recipients Arfrever, elixir, ishimoto, jwilk, loewis, methane, mrabarnett, ncoghlan, nikratio, pitrou, rurpy2, serhiy.storchaka, vstinner
Date 2014-02-04.21:50:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In-reply-to <>
On 02/04/2014 03:28 AM, Nick Coghlan wrote:
> Nick Coghlan added the comment:
> If operating systems always exposed accurate metadata and configuration settings, I'd agree with you. They don't though, so sometimes developers need to be able to override whatever the interpreter figured out automatically.

Where does the operating system come into play? What I'm trying to say
is that any code of the form

fh = some_python_function()

should really be written as

fh = some_python_function(encoding=foo)


fh = TextIOWrapper(some_python_function(raw=True), encoding=foo)

The only exception to this is sys.std{in,out,err}. But this special case
should, in my opinion, be solved with a corresponding special function
in sys.*, rather than a general purpose method in TextIOWrapper.

> In addition, needing to cope with badly designed APIs is an unfortunate fact of life - that's why monkeypatching is only *discouraged*, rather than disallowed :)

Well, yes, but introducing a set_encoding() or reconfigure() function is
actively *encouraging* bad API design. "I'll just return my favorite
encoding from this function, after all, the caller can use set_encoding


Encrypted emails preferred.
PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6  02CF A9AD B7F8 AE4E 425C

             »Time flies like an arrow, fruit flies like a Banana.«
Date User Action Args
2014-02-04 21:50:46nikratiosetrecipients: + nikratio, loewis, ishimoto, ncoghlan, pitrou, vstinner, jwilk, mrabarnett, Arfrever, methane, rurpy2, serhiy.storchaka, elixir
2014-02-04 21:50:46nikratiolinkissue15216 messages
2014-02-04 21:50:46nikratiocreate