#define equivalents and config files

Dave Swegen dswegen at software.plasmon.com
Thu Mar 21 03:53:07 EST 2002


On Wed, Mar 20, 2002 at 11:43:43PM -0500, Peter Hansen wrote:
> Rich Salz wrote:
> > 
> > > Is there a pythonic way of doing something similiar to Cs #define?
> >  >... are globals the only way to go?
> > 
> > You can at least make them class attributes
> >         class constants:
> >                 pi = 3.14159
> >                 e = 2.71828
> > adding your own setattr can serve to make them read-only.
> 
> That wouldn't help when one needed to change the values...

I'm basically after a single file where such values can be stored, and
then used in various parts of the program without having to pass extra
configuation variables around.

Cheers
	Dave




More information about the Python-list mailing list