print v. print()

Mel mwilson at the-wire.com
Sat Aug 14 11:44:22 EDT 2010


Thomas Jollans wrote:
> On Saturday 14 August 2010, it occurred to Frederick 
Williams to exclaim:

>> So why the change from print to print()?

> There's no reason for print to be a statement -- it can 
just as well be a
> function, which makes the language more regular, and 
therefore quite
> possibly easier to learn.

The downside to a print() function is that assigning to 
`print` can mask the function, and leave a neophyte without 
any way to get output out of the program.

The problem with that downside, I guess, is that rogue 
assignment to sys.stdout can kill a print statement just as 
dead as a print() function, so the statement's so-called 
advantage is not that great.

	Mel.




More information about the Python-list mailing list