[Tutor] replacement for constants from other languages in Python?
Danny Yoo
dyoo at hkn.eecs.berkeley.edu
Thu Jan 6 20:19:51 CET 2005
On Thu, 6 Jan 2005, Alan Gauld wrote:
> > I'm _very_ used to using C style constants (preprocessor #define
> > directives) or C++ const keyword style, for a variety of reasons.
> >
> > I've yet to see anything covering 'how to work around the lack of
> > constants in Python'...can anyone point me in the right direction
> > here?
Hi Scott,
There are a few recipes in the Python Cookbook that mentions how to get a
"const" mechanism in Python:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65207
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/197965
But I have to admit that I don't use this approach myself; I've been using
the uppercase convension, and it seems to work ok.
Good luck to you!
More information about the Tutor
mailing list