[Tutor] Re: Dynamic variables names to objects of the same class ?
Lee Harr
missive at hotmail.com
Sat Aug 23 16:22:17 EDT 2003
import ConfigReader
config = ConfigReader( "./config.file")
config.AddKey( "MAX_THREADS", INT )
config.ReadConfigFile()
noOfThreads = config.MAX_THREADS
Hi;
I am not exactly sure what you need to do, but maybe something
along the lines of...
if hasattr(config, 'MAX_THREADS'):
noOfThreads = config.MAX_THREADS
else:
noOfThreads = DEFAULT_MAX_THREADS
or
try:
noOfThreads = config.MAX_THREADS
except KeyError:
noOfThreads = DEFAULT_MAX_THREADS
will help.
ps. please send only plain text to the list :o)
_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail
More information about the Tutor
mailing list