Mel wrote:
Steven D'Aprano wrote:
On Thu, 21 Oct 2010 12:49:47 +0000, Neil Cerutti wrote:
_The Practice of Programming_ has this right. In general the bigger the
scope of a variable, the longer and more descriptive should be its name.
In a small scope, a big name is mostly noise.
Thank you! The scope of the variable is an important factor.
Wittgenstein remarked somewhere* "...it is the particular use of a word only
which gives the word its meaning...". For a variable, if you can see the
entire use at a glance, then any other cues to its meaning, like a long
variable name, are redundant.
Long variable names can lie; they share this ability with comments. The one
study** I've seen of newbie errors observed the #1 error being as assumption
that descriptive variable names could somehow replace computation, e.g. that
if you called a variable "total_sales", then accessing it would get you a
sales total, regardless of what you might or might not write as
computational statements.
Mel.
So If I get you right, because comments can lie, we should stop using
comments ?
Computation never lies ? Well that's called a bug, and they are your
every day worries.
Meaningfull names helps spotting miscomputation.
total_sales = some_computation()
How are you supposed to verify that some_computation is filling its role
without even knowing what it is supposed to do ?
While I totally understand why some ppl prefer to use short names, I
really don't see the point in saying that because any information can be
wrong, we should stop giving any.
JM
--
http://mail.python.org/mailman/listinfo/python-list