LWN.net Logo

please don't use Python-3

please don't use Python-3

Posted Dec 5, 2008 19:56 UTC (Fri) by edlenz (guest, #12021)
In reply to: please don't use Python-3 by zooko
Parent article: Python 3.0 released

This feature is intersting...

a=[1,2,3]
f=open("file.txt","w")
print(a,file=f)
f.close()

works with any object with .__str__ mehtod.


(Log in to post comments)

please don't use Python-3

Posted Dec 5, 2008 22:11 UTC (Fri) by nevyn (subscriber, #33129) [Link]

That's not a feature, just different syntax (I agree it's better, but it's also different):

a = [1,2,3]
f = open("/tmp/file.txt","w")
print >>f, a

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds