Rod Person wrote:
> We have a module called constants.py, which contains [whatever] related to
> server names, databases, service account users and their passwords.
Passwords?
> In order to be able to use constants as command line parameters for
> calling from our batch files I created the class below that checks to
> make sure the parameter value is a valid constant and if so return its
> value.
Instead of
> from CCBH import constants
...
> if not hasattr(constants, value):
...
You can look up the name in the global namespace:
if value not in globals():
...
--
http://mail.python.org/mailman/listinfo/python-list