On 11 September 2000, Tim Peters said: > > So as long as one uses extended print, she's already an advanced user. > > Nope! "Now how did I get this to print to a file instead?" is one of the > faqiest of newbie FAQs on c.l.py, and the answers they've been given in the > past were sheer torture for them ("sys? what's that? rebind sys.stdout to > a file-like object? what?! etc"). But that's only an argument for "print >>file"; it doesn't support "print >>None" == "print >>sys.stdout" == "print" at all. The only possible rationale I can see for that equivalence is in a function that wraps print; it lets you get away with this: def my_print (string, file=None): print >> file, string instead of this: def my_print (string, file=None): if file is None: file = sys.stdout print >> file, string ...which is *not* sufficient justification for the tortured syntax *and* bizarre semantics. I can live with the tortured ">>" syntax, but coupled with the bizarre "None == sys.stdout" semantics, this is too much. Hmmm. Reviewing my post, I think someone needs to decide what the coding standard for ">>" is: "print >>file" or "print >> file"? ;-) Greg
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4