PEP 214 - Why not print >> string?

Skip Montanaro skip at pobox.com
Thu Jan 10 15:05:13 EST 2002


    >> x = ''
    >> print >> x, 3
    >> print >> x, 3
    >> 
    >> would cause x to be '3 3'?  Or would it be '3\n3\n' ?

3\n3\n

    >> What if I forgot to say  x = ''  first?

NameError

    >> Or what if you said x = 0 first?

TypeError

    >> Maybe what he meant was that:

    >>  print >> string, value

    >> would be equivalent to:

    >>  string = `string` + `value`

I don't think so.  If you want it to behave exactly like print currently
does you need the newlines and soft spaces.

-- 
Skip Montanaro (skip at pobox.com - http://www.mojam.com/)




More information about the Python-list mailing list