PEP 214 - Why not print >> string?

Steve Holden sholden at holdenweb.com
Thu Jan 10 14:22:18 EST 2002


"Aaron Swartz" <me at aaronsw.com> wrote in message
news:B86336BD.17E65%me at aaronsw.com...
> On 2002-10-01 11:16 AM, in article
> M1k%7.10891$wd4.1322364 at atlpnn01.usenetserver.com, "Steve Holden"
> <sholden at holdenweb.com> wrote:
>
> > Unfortunately, this would seem to require that a variable name be bound
to a
> > string value in order to indicate that the result of the print statement
> > should overwrite it. Then the prints are rebinding the named variable
> > (obviously, since the string values are immutable). This seems a little
> > bizarre.
>
> 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).
>

Well, doesn't string += "value" rebind the name string?

regards
 Steve
--
http://www.holdenweb.com/








More information about the Python-list mailing list