Nested scopes hitch

François Pinard pinard at iro.umontreal.ca
Mon Apr 8 20:05:34 EDT 2002


[Jeff Shannon]

> If you want access to variables inside of a function, you should 
> pass those specific variables as arguments.  If you've got lots 
> of arguments in common between lots of functions, assemble the 
> lot into a class.  If neither of these is appropriate, then you 
> should redesign -- you're using a very ugly approach.

I beg to disagree, a bit strongly.

Something is not ugly just because you prefer something else.  I have very,
very neat applications which use globals() and locals(), and they will
loose much if they use arguments all over, or get assembled into classes.

It is possible that the evolution of Python forces me away of these
nice ways, and I'll happily make necessary adjustments in the name of a
greater good.  But I resist the idea that we were wrong or ugly, before.

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard





More information about the Python-list mailing list