print() function with encoding= and errors= parameters?

Random832 random832 at fastmail.com
Wed Aug 3 11:30:19 EDT 2016


On Wed, Aug 3, 2016, at 11:09, Peter Otten wrote:
> I'm unsure about this myself -- wouldn't it be better to detach the 
> underlying raw stream? Like

Well, "better" depends on your point of view.

> The ValueError raised if you try to write to the original stdout
> looks like a feature to me.

Maybe. But if the goal is to not cause problems for other code that
consumes the original stdio, this is very much not a feature.

Of course, it's hard to imagine in what kind of program design it is
reasonable for there not to be a single guiding principle controlling
all of the code that sends output to stdout, but I'm not the one asking
the question here.



More information about the Python-list mailing list