[Python-ideas] 'Injecting' objects as function-local constants

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Jun 14 02:52:28 CEST 2011


Steven D'Aprano wrote:

> My apologies, I've been doing a lot of reading about the pros and cons 
> (mostly cons *wink*) of monkey-patching in the Ruby world, the 
> open/closed principle, and various forms of bugs caused by the use of 
> globals.

I think part of the problem is that for the particular example
you chose -- a "verbose" option to a command-line script --
you usually *do* want it to apply to the entire program, so
using a global is perfectly adequate in that case.

-- 
Greg



More information about the Python-ideas mailing list