"as" keyword woes

Andreas Waldenburger geekmail at usenot.de
Thu Dec 4 14:41:21 EST 2008


On Thu, 4 Dec 2008 10:44:33 -0600 "Chris Mellon" <arkanes at gmail.com>
wrote:

> Aside from the cultural indoctrination, though (and that may be a real
> and strong force when dealing with math software, and I don't want to
> discount it in general, just for purposes of this discussion) why is
> it more sensible to use "x" here instead of "number" or "real" or
> "real_number" or something else?

I think "aside from" doesn't really apply. It is habitual to write
mathematics in shorthand. That is a, if not *the* factor to consider.

Also: Variable names in programs tend to describe what those things
*do* not what they are. If I call a variable "number", the reader will
usually none the wiser, because you deal with numbers a lot anyway.
You'd call your numbers "counter", "height", "pressure" and the like.

If however you do lots of numerical computations, your numbers tend to
be just that, numbers. You'll gain nothing but confusion by calling them
"number1", "number2", "number3". They are then much easier to discern
by calling them x, y and z.

I think.
/W

-- 
My real email address is constructed by swapping the domain with the
recipient (local part).



More information about the Python-list mailing list