Thinking about "print >>"
williamc at go2net.com
Thu Sep 7 06:02:12 CEST 2000
Just to further beat a dead horse... I've submitted a patch to SourceForge which
corrects the currently perl like syntax for printing to a file.
The syntax accepted by the patch is as follows:
print [to <file> [,]] [<item> (item ',')* [,]]
print to sys.stderr "Spammity spam, glorious spam!"
The comma after the 'to file' portion to make the following construct work:
print to file, 
Since "print to file " is a vain attempt to index the list/dict 'file'.
The patch is at
No, 'to' is not treated as a keyword elsewhere. Yes, if you have a variable
named 'to' its value is unaffected by this, and it should matter anyway since
if you wanted to print to and something else, you'd use "print to, file,".
And hopefully someone will give it a look over I think the syntax is much more
consistant with the overall spirit of Python than this hackish looking
CVS Repo-man ** Go2Net Web Operations Group
More information about the Python-list