Is this optparse object abuse?

John O'Hagan research at johnohagan.com
Sun Nov 16 22:07:59 EST 2008


On Sun, 16 Nov 2008, Bruno Desthuilliers wrote:
> John O'Hagan a écrit :
[...]
>
> > In other words, using the optparse object to hold as attributes
> > everything needed by all the functions and methods in the module, and
> > simply passing it holus bolus to all them and just pulling out what's
> > actually needed inside the function, even adding new attributes or
> > reassigning old ones along the way.
>
> Congratulations, you just reinvented globals and spaghetti-code.
>
[..]
I'm aware of the potential for such problems, which is why I posted this 
question hoping for constructive advice.
>
> > My question is: is this horribly inefficient or otherwise wrong?
>
> The only thing I can say is that I hope I'll *never* have to maintain
> your code.

Regards,

John O'Hagan




More information about the Python-list mailing list