PEP 214 - Why not print >> string?
Mark McEahern
marklists at mceahern.com
Thu Jan 10 14:53:43 EST 2002
Andrew Koenig:
> So
> x = ''
> print >> x, 3
> print >> x, 3
>
> would cause x to be '3 3'? Or would it be '3\n3\n' ?
>
> What if I forgot to say x = '' first?
Or what if you said x = 0 first?
Aaron:
> I'm not sure I see why. It would function similarly to += on strings.
> print >> string, 'value'
> would be equivalent to:
> string += 'value'
> (except you'd get the nice print formatting rules).
Maybe what he meant was that:
print >> string, value
would be equivalent to:
string = `string` + `value`
// mark
More information about the Python-list
mailing list