On Wed, Jan 14, 2009 at 4:49 PM, Brendan Miller <catph...@catphive.net> wrote: > PEP 8 doesn't mention anything about using all caps to indicate a constant. > > Is all caps meaning "don't reassign this var" a strong enough > convention to not be considered violating good python style? I see a > lot of people using it, but I also see a lot of people writing > non-pythonic code... so I thought I'd see what the consensus is.
It may in fact be deliberate. As there really are no such thing as constants in Python - clearly :) However, on the rare occasion I need to define a global variable in a module that gets used in several places and is more or less used as a standard configured value - I tend to use ALL CAPS. Still I would avoid using this idiom altogether and jsut stick with default values. For Example: FOO = 1 def f(x=FOO): ... Use this instead: def f(x=1): ... cheers James -- http://mail.python.org/mailman/listinfo/python-list