[Python-Dev] Re: LOAD_NAME & classes

François Pinard pinard@iro.umontreal.ca
23 Apr 2002 15:49:47 -0400


[Michael Gilfix]

> It would be nice if python offered a facility for sharing pooled data:
> maybe a global configuration object?  That way it's more explicit.
> It could also remove some redundant code that I tend to put in many
> applications.

>   import config

>   my_opt = config.get_opt ('mymodule')
>   # Set a new global opt
>   config.set_opt ('attrib') = blah

>   Maybe even provide some hooks for populating the config object.

I already use `config' (that precise identifier) a lot in my things,
so please do not even _think_ using it for something else! :-) :-)

For small projects, such a thing might be overkill.  For big projects,
there are a few (maybe many) avenues and ways how to achieve this sharing,
and I'm glad having the freedom of installing subtle nuances between
projects, as needed.  That is, I would fear a bit being pulled in an
arbitrary direction: it would have to be convincingly damned good. :-)

Better, maybe, would be to merely document some of the possible avenues.
Most of these require only a tiny investment in lines of code anyway.

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