Global variables for python applications

Duncan Booth duncan.booth at invalid.invalid
Tue May 18 04:39:43 EDT 2010


Steven D'Aprano <steve at REMOVE-THIS-cybersource.com.au> wrote:

> I think it is an abuse of the term constant to allow you to talk about a 
> mutable object being "constant", since it can vary. Generally, you don't 
> care about identity, only equality. Making up a syntax on the spot:
> 
> constant pi = [3.1415]
> assert pi = 3.1415
> pi[0] = 3
> assert pi = 3.1415
> 
> makes a mockery of the concept of a constant.

A better keyword might be something like 'alias' to imply that the name and 
value are interchangeable.

-- 
Duncan Booth http://kupuguy.blogspot.com



More information about the Python-list mailing list