print >> details???

Carsten Gaebler clpy at snakefarm.org
Fri Mar 8 09:11:45 EST 2002


spex66 wrote:

> class x:
>    def write(self, s):
>       print 'START'
>       print s
>       print 'END'
> 
> print >> x(), 'Hello'
> 
> and got following result:
> 
> START
> Hello
> END
> START
> 
> END
> 
> where does the second call of x.write() come from???

It comes from the newline character that is automatically appended by
the print statement. You can see it if you replace 'print s' by 'print
repr(s)'.

cg.
-- 
'In iteger arithetric divsion is no the oposite of multiplication.'
                                   -- scenes from comp.lang.python



More information about the Python-list mailing list