[print >>] None

Barry A. Warsaw barry at zope.com
Tue Oct 23 23:10:39 EDT 2001


>>>>> "BP" == Bjorn Pettersen <BPettersen at NAREX.com> writes:

    BP> It's actually part of the magic of print >> None that it
    BP> prints to sys.stdout (yeah, I know, I wasn't in favor of that
    BP> either ;-)

Neither was I <wink>.  I lobbied for "print >> None" to be morally
equivalent to:

class Devnull:
...  def write(self, s): pass
... 
>>> devnull = Devnull()
>>> print >> devnull, 'this goes no where'
>>> 

but lost that argument.  I've never had a use for current
print>>None's semantics but I've had one or two situations where
printing to a null sink was handy (e.g. doing verbose prints that get
turned off with a --quiet flag).

-Barry



More information about the Python-list mailing list