Author ncoghlan
Recipients Arfrever, elixir, inada.naoki, ishimoto, jwilk, loewis, mrabarnett, ncoghlan, nikratio, pitrou, rurpy2, serhiy.storchaka, vstinner
Date 2014-02-05.00:25:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CADiSq7dRSj3MPgb+VxUN-9HJdF2cb2_UCuSsRX1uDGEAyvEC-A@mail.gmail.com>
In-reply-to <52F160B3.600@rath.org>
Content
Metaclasses and monkeypatching encourage bad API design, too, but we still
provide them because they're essential tools for some use cases. In Python,
the system integrator is always right, and we provide them with power tools
to deal with the cases where reality doesn't want to cooperate with the
nice neat model of the world that we provide by default.

For the standard streams, the problem is that the stream is created
automatically by the interpreter, and sometimes we will get the encoding
choice wrong (because the info we retrieve from the OS doesn't match what
the user actually wants), but rebinding the names to a new IO stream causes
other problems. Now, we have two choices at this point:

1. Assume there is *no other API involving implicit text stream creation in
any third party Python 3 library anywhere* that will ever have this problem
and create a solution that only works with the standard streams

2. Acknowledge that while the implicit way we create the standard streams
is unusual, it is unlikely to be *unique*, so it actually does make sense
to provide the ability to change the encoding of an existing stream as a
general purpose feature fenced about with as many "you probably don't want
to use this unless you really know what you are doing, otherwise it may eat
your data" warnings as seems appropriate.
History
Date User Action Args
2014-02-05 00:25:42ncoghlansetrecipients: + ncoghlan, loewis, ishimoto, pitrou, vstinner, jwilk, mrabarnett, Arfrever, inada.naoki, nikratio, rurpy2, serhiy.storchaka, elixir
2014-02-05 00:25:42ncoghlanlinkissue15216 messages
2014-02-05 00:25:42ncoghlancreate