David Garamond davegaramond at
Sun Aug 25 20:49:30 CEST 2002

does python support some sort of constant variables?

in ruby, variables that begin with an uppercase letter is considered a 
constant. that is, once bound to a value, nobody can rebind it until the 
end of program execution (though it certainly does not prevent the bound 
object value to be changed):

$ irb
irb(main):001:0> A=1
irb(main):002:0> A=2
(irb):2: warning: already initialized constant A
irb(main):003:0> B=[1,2,3]
irb(main):006:0> B[1]=3
irb(main):007:0> B
[1, 3, 3]


More information about the Python-list mailing list