line wrapping problem

Juho Schultz juho.schultz at helsinki.fi
Thu Feb 9 10:04:50 EST 2006


ZeD wrote:
> Ciao, Juho Schultz! Che stavi dicendo?
> 
Moro, ZeD! Kunhan pulisen. Should we stick to English?
> 
>>should work. IMO file.write() is self-explanatory but "print >> file" is
>>a bit obscure.
> 
> is obscure only if you have never used a shell :)
> 
(I have used the shell a bit. I started using Linux at work when 2.2 
series kernels did not exist.)

Assume a newbie plays around with a piece code. If the code has 
f.write(x) or print >> f,x - in which case the newbie is more likely to 
break the code by rebinding f to something non-file? And in which case 
he will more likely understand the error message, something like "f has 
no write attribute"?

I am sure the >> can be useful - it is quick to add after a simple print 
when you want less chatter and more logfiles. But IMO it is not 
self-documenting. Having to very different uses for an operator in the 
same language is sort of confusing.



More information about the Python-list mailing list