#define equivalents and config files

Peter Hansen peter at engcorp.com
Wed Mar 20 23:43:43 EST 2002


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...

;-)



More information about the Python-list mailing list