Global variables for python applications

Gregory Ewing greg.ewing at canterbury.ac.nz
Mon May 17 03:56:15 EDT 2010


John Nagle wrote:
> Also, more compile-time arithmetic becomes possible.

But only if their values can be computed at compile time. This
leads to a huge can of worms if you want to be able to import
named constants from other modules. A large part of what
currently happens only at run time would have to become
possible at compile time as well. Either that or so many
restrictions would have to be placed on the way that the
values of named constants are specified that they would not
be very useful in practice.

>    I think there's some religious objection to constants in Python,

Not religious, but pragmatic. What appears to be a simple and
obvious idea on the surface turns out not to be nearly so simple
or obvious in a language as dynamic as Python.

-- 
Greg



More information about the Python-list mailing list