A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2000-September/009261.html below:

[Python-Dev] Challenge about print >> None

[Python-Dev] Challenge about print >> NoneBarry A. Warsaw bwarsaw@beopen.com
Fri, 8 Sep 2000 11:27:24 -0400 (EDT)
>>>>> "VM" == Vladimir Marangozov <Vladimir.Marangozov@inrialpes.fr> writes:

    VM> Seems like people are very surprised to see "print >> None"
    VM> defaulting to "print >> sys.stderr". I must confess that now
    VM> that I'm looking at it and after reading the PEP, this change
    VM> lacks some argumentation.

sys.stdout, not stderr.

I was pretty solidly -0 on this extension, but Guido wanted it (and
even supplied the necessary patch!).  It tastes too magical to me,
for exactly the same reasons you describe.

I hadn't thought of the None == /dev/null equivalence, but that's a
better idea, IMO.  In fact, perhaps the printing could be optimized
away when None is used (although you'd lose any side-effects there
might be).  This would actually make extended print more useful
because if you used

    print >> logfile

everywhere, you'd only need to start passing in logfile=None to
disable printing.  OTOH, it's not to hard to use

    class Devnull:
        def write(self, msg): pass
	

logfile=Devnull()

We'll have to wait until after the weekend for Guido's pronouncement.

-Barry





RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4