print v. print()

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Sun Aug 15 02:11:11 CEST 2010


On Sat, 14 Aug 2010 11:44:22 -0400, Mel wrote:

> 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.

On the other hand, the upside to a print() function is that assigning to 
`print` can monkey-patch the function, allowing the advanced user to 
modify it's functionality at runtime. Whether that's a feature or a 
shooting offence is a matter of opinion.

(I think it's a feature, albeit one which is easy to misuse.)


-- 
Steven



More information about the Python-list mailing list