[Python-3000] symbols?
Ian D. Bollinger
ian.bollinger at gmail.com
Fri Apr 14 08:28:25 CEST 2006
Adam DePrince wrote:
> On Wed, 2006-04-12 at 05:15 -0700, Michael Chermside wrote:
>
>> When I see a variable name in all-caps, I don't assign to it. I don't
>> even need a tool like PyChecker to remind me that this is a constant
>> because I've been familiar with the "all-caps == constant" convention
>> from shortly after I got a computer with lower-case letters on it.
>> The other programmers I work with seem to behave the same way. I must
>> be unusually lucky in this regard, because I meet lots of people who
>> are very concerned about the fact that it *is* possible to change
>> these values. I can only surmise that they work with people who make
>> a habit of modifying all-caps variables randomly just for fun.
>>
> One thing we should consider is how euro-centric this convention is.
> I'm not certain that all of the characters in all eastern languages can
> be readily divided into upper and lower cases. IIRC one of the goals
> with P3K is to allow Python to compile unicode source files, with that
> this convention will eventually stop working.
>
All identifiers have a standard naming convention involving case, so we
should throw them out because maybe in the future someone will be able
to write identifiers in Mandarin Chinese? I hope I never have to
decipher such code. Also, at first I cared about giving constants
all-capital names as a carry over from statically-typed languages, but
eventually I dropped the convention. In the majority of cases where I
might use a constant in a statically typed language, the constancy
doesn't seem significant enough to denote in a Python variable name.
And if I really need a unique object, I use the same convention the
built-ins use (None, Ellipsis, etc.)
More information about the Python-3000
mailing list