Martin P. Hellwig wrote:
On 10/20/10 22:09, Seebs wrote:
On 2010-10-20, Matteo Landi<landima...@gmail.com>  wrote:
Another situation in which I needed to disable such kind of warnings
is while working with graphics modules.
I often use variable names such as x, y, z for coordinates, or r,g,b for colors.
Would longer names make the reader's life easier?

Interesting point.  Which is really easier to read:

    x, y, z = p.nextpoint()

xCoordinate, yCoordinate, zCoordinate = polygon.nextPointCoordinates()

-s

Although intuitively I would say the shorthand, however that is depending on the context being me knowing at least the basics of 3d spaces and having the pre-warning that you are going to mention something with either coordinates or colours.

Take away this pre-information, as you would when first reading an application, and all of the sudden the latter would be much clearer to the fellow programmer.

I couldn't have said it better (I'll ignore the anti-camelCase lobby for now :D )

In the middle of thousand lines of code, 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 ??


vs

xCoordinate, yCoordinate, zCoordinate = polygon.nextPointCoordinates()
[snip a dozen of code line]
...
...
...
...
...
...
...
...
yCoordinate += 1

JM


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to