declare a constant in Python?
Dave Brueck
dave at pythonapocrypha.com
Thu Sep 9 14:05:38 EDT 2004
beliavsky at aol.com wrote:
> I wish one could declare a constant in Python, analogous to 'const int
> i=1;' in C++. Is there a way to get this effect?
With a bit of work, yes - Google will turn up some recipes for it.
It's basically never worth the effort because in practice it offers no advantage
over just a naming convention (i.e. nobody accidentally rebinds their values, so
doing that extra work doesn't provide any practical benefit).
-Dave
More information about the Python-list
mailing list