Why does Python do this?

Bengt Richter bokr at oz.net
Fri Jul 25 22:30:01 EDT 2003


On Fri, 25 Jul 2003 15:22:13 -0600, Steven Taschuk <staschuk at telusplanet.net> wrote:

>Quoth Gre7g Luterman:
>  [...]
>> Python 2.2.2 (#3, Jun 16 2003, 19:11:56)
>  [...]
>> >>> class b:
>> ...   def __str__(self):
>> ...     print "printed"
>> ...     return "returned"
>  [...]
>> >>> print y
>>  printed
>> returned
>> 
>> Note the extra space printed when I executed the "print y" command.
>
>I don't know why this happens in 2.2, but I observe that it
>doesn't in 2.3.  Presumably some softspace fix has been made.

I argued hard that there was something wrong in

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&selm=b952va%24hlt%240%40216.39.172.122&rnum=11

I wonder if those examples work now too ;-)

Regards,
Bengt Richter




More information about the Python-list mailing list