print() in Python 3000 return value?

Georg Brandl g.brandl-nospam at gmx.net
Sun Apr 2 15:51:14 EDT 2006


Gary Herron wrote:

>>for i in sequence:
>>	mylist.append(print(i))
>>
>>  
>>
> No no, please NO!   You *know* that someday you'll want the return value 
> without actually printing the text. 
> 
> So let's don't overload a single function with two operations.  Let 
> "print" print, and propose a separate function (named "format" --yuck-- 
> or some such) that returns the same text as a string.

Yes! That's really a good idea. But "format" is a bad name. Let's call it
"as_string"!

Hm, bad too. What about "text"?

No, now I know. Let it be called "str".

Georg



More information about the Python-list mailing list