[Python-Dev] Challenge about print >> None

Jeremy Hylton jeremy@beopen.com
Mon, 11 Sep 2000 18:24:13 -0400 (EDT)

>>>>> "GvR" == Guido van Rossum <guido@beopen.com> writes:

  GvR> Don't think of it as

  GvR>   print >>None, args

  GvR> Think of it as

  GvR>   def func(file=None):
  GvR>     print >>file, args

Huh?  Don't you mean think of it as:

def func(file=None):
    if file is None:
       import sys
       print >>sys.stdout, args
	print >>file, args

At least, I think that's why I find the use of None confusing.  I find
it hard to make a strong association between None and sys.stdout.  In
fact, when I was typing this message, I wrote it as sys.stderr and
only discovered my error upon re-reading the initial message.