pylint -- should I just ignore it sometimes?

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Thu Oct 21 08:54:22 EDT 2010


On Thu, 21 Oct 2010 11:37:36 +0200, Jean-Michel Pichavant wrote:

> In the middle of thousand lines of code, 

If you have a function that is a thousand lines of code long, I don't 
care what you name the variables, you won't be able to keep it straight 
in your head.

This is one of the reasons why we break code up into functions -- so you 
don't have to remember 1000 lines worth of variables names all at once.


> when you are reviewing or
> debugging, the later is better TMO, the point is that x, y, z = is only
> easy to read during the assignement. Consider this:
> 
> x, y, z = p.nextpoint()
> [snip a dozen of code line]
> ...
> ...
> ...
> ...
> ...
> ...
> ...
> ...
> y += 1 # hmmm ??

A dozen lines isn't much. They will all fit on the screen at once.

Honestly, you guys are talking about variable names as if the average 
coder was a moron barely more intelligent than a pigeon. Seriously, even 
*goldfish* have better memory than that -- they can remember events for 
many minutes at a time. That's the fatal flaw in your argument... if you 
don't credit the average programmer with being able to remember that y is 
an ordinate of a point after just twelve lines, what makes you think he 
can remember that "yCoordinate" is the *second* item in the tuple, rather 
than the first, or third, or twenty-first?

If coders were really as dim-witted as you seem to believe, you would 
have to write:

firstItemOfPointCoordinates, secondItemOfPointCoordinates, \
  thirdItemOfPointCoordinates = polygon. \
  methodReturningNextPoint3ItemCoordinate()

Whew.


I find it ironic that after complaining about single character variable 
names, you sign your post with your initials "JM" instead of "Jean-Michel 
Pichavant".



By the way:

> xCoordinate, yCoordinate, zCoordinate = polygon.nextPointCoordinates()

Coordinates are pairs or triples of *ordinates* (no "co"). You can't have 
an "x coordinate" -- that would be like unpacking a single pair of shoes 
into a "left-pair" and a "right-pair".



-- 
Steven



More information about the Python-list mailing list