YA string interpolation and printing idea
Paul Rubin
http
Fri Jan 16 23:52:08 EST 2004
Erik Max Francis <max at alcyone.com> writes:
> Why in the world would you want that? Printing methods go on the things
> that do work of printing, which are file-like objects, not strings.
To give a convenient way to do interpolated printing. Practicality
beats purity. Another approach I like is to define a unary minus
operation on strings, which does interpolation. But that's gone
nowhere when I've proposed it in the past. Maybe if type/object
unification proceeds far enough, we'll someday be able to define our
own operations on builtin objects like strings.
> And, on file-like objects, that method is called `write'.
'write' does what it should, which is writes out exactly the
characters you give it. Python's print statement does the same plus
adds a newline, and people have gotten used to that misbehavior
(explicit is better than implicit), so I made an accomodation for that.
More information about the Python-list
mailing list