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. * "somewhere" hah! I covertly looked it up. It's in the _Blue and Brown Books_. ** This I haven't looked up. It got some publicity a year or so ago. It started when somebody gave a mid-term computer science test to a class who had only just started the course. Then they studied the results to find out what the students might have been thinking. -- http://mail.python.org/mailman/listinfo/python-list