[Python-Dev] Challenge about print >> None
Vladimir Marangozov
Vladimir.Marangozov@inrialpes.fr
Wed, 13 Sep 2000 15:58:53 +0200 (CEST)
Just van Rossum wrote:
>
> Amen.
>
The good thing is that we discussed this relatively in time. Like other
minor existing Python features, this one is probably going to die in
a dark corner due to the following conclusions:
1. print >> None generates multiple interpretations. It doesn't really
matter which one is right or wrong. There is confusion. Face it.
2. For many users, "print >>None makes the '>>None' part disappear"
is perceived as too magic and inconsistent in the face of general
public knowledge on redirecting output. Honor that opinion.
3. Any specialization of None is bad. None == sys.stdout is no better
than None == NullFile. A bug in users code may cause passing None
which will dump the output to stdout, while it's meant to go into
a file (say, a web log). This would be hard to catch and once this
bites you, you'll start adding extra checks to make sure you're not
passing None. (IOW, the same -1 on NullFile applies to sys.stdout)
A safe recommendation is to back this out and make it raise an exception.
No functionality of _extended_ print is lost.
whatever-the-outcome-is,-update-the-PEP'ly y'rs
--
Vladimir MARANGOZOV | Vladimir.Marangozov@inrialpes.fr
http://sirac.inrialpes.fr/~marangoz | tel:(+33-4)76615277 fax:76615252