pylint -- should I just ignore it sometimes?

Seebs usenet-nospam at seebs.net
Wed Oct 20 19:47:35 CEST 2010


On 2010-10-20, Jean-Michel Pichavant <jeanmichel at sequans.com> wrote:
> except ValueError, e:

> Use meaningful names, this is so important.

It's important, but meaning can come from idiom, not from the word used.

> 'e' is not meaningful. 

Sure it is.  It's like i for a loop index.

There's a reason mathematicians use x, not the_value_that_can_vary.

> When dealing with such issue like "I'm too lazy to 
> write proper engligh" always think that what is the most important thing 
> is to save the Reader's time, not the Writer's time. Using 'e' would 
> force to reader to introspect to code to get an idea of what 'e' is. 

If the reader can't track a single-letter idiomatic name over two consecutive
lines of code, I don't think I can save the reader time.  The reader is beyond
my ability to help at that point.

Furthermore, long names take longer to read and process.

As a *reader*, I vastly prefer:
	except foo, e:
		print "Fatal error:", e
to anything you could do with a longer name.

Consider, admittedly a C example:
	for (int i = 0; i < n; ++i)
		a[i] += 1;
vs:
	for (int index_into_array = 0; index_into_array < size_of_array; ++index_into_array)
		array_into_which_we_are_indexing[index_into_array] += 1;

Here's the thing.  The issue is not that I'm too lazy to write English.  The
issue is that English, like every other language, USES PRONOUNS.  Because
pronouns are a good way to MASSIVELY streamline communication.  It's not just
a convenience to the writer/speaker; it also makes life easier for the
reader/listener.

Short variable names are pronouns.  They make sense when you'd use a
pronoun in English.

"If we catch a KeyError, we print an error message including it."

We'd use a pronoun.  Makes sense to use a short variable name.

> Moreover, code completion makes use of long names costless.

No, it doesn't.  It preserves their higher cognitive load in parsing.

Dogmatism about rejecting short variable names is inconsistent with the
psychology of human readers.  Compilers don't care about length of
variable names.  Humans do, and there are times when they benefit more
from a short and recognizeable name than they do from a long and
"expressive" one.

-s
-- 
Copyright 2010, all wrongs reversed.  Peter Seebach / usenet-nospam at seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
I am not speaking for my employer, although they do rent some of my opinions.



More information about the Python-list mailing list