What do you mean enabled? If it's imported into the namespace you can call it...
Err, can you clarify on the enabling, what context are you using it in, and what are you trying to achieve? On 11/25/05, Negroup - <[EMAIL PROTECTED]> wrote: > Hi all! I'm here again with a question about introspection. > > My module stores a set of functions. I need to know, from another > script, if a particular function of this module "is enabled" (it > means, if it shall be executed by the caller script). I looked for > some introspective builtin/function, but I didn't find anything useful > (except func_globals, func_dict, func_code, etc, that don't help in my > case). > > This is my solution: > > mymodule.py > def f1(): > pass > def f2(): > pass > > setattr(f1, 'enabled', True) > setattr(f2, 'enabled', False) > > [EMAIL PROTECTED]:~/projects/erp/migra$ python > Python 2.3.5 (#1, Sep 6 2005, 12:53:27) > [GCC 3.3.4] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> from mymodule import * > >>> f1.enabled > False > >>> f2.enabled > True > > This seems to work.. I wonder for better solutions. > > Thanks you all! > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor