Seebs wrote:
On 2010-10-21, Jean-Michel Pichavant <jeanmic...@sequans.com> wrote:
It can be short if descriptive:
for o, c in cars:
park(o)
phone(c)
for owner, car in cars: # by just using meaningful names you give the
info to the reader that you expect cars to be a list of tuple (owner, car)
park(owner)
phone(car) # see how it is easier to spot bug
In this case, yes.
The one that brought this up, though, was "except FooError, e:", and in
that case, there is no need for any further description; the description
is provided by the "except", and "e" is a perfectly reasonable, idiomatic,
pronoun for the caught exception.
-s
same for the exception.
Let's say you're reading some code, someone else code. You can't just
read everything so you're reading through quickly.
You first hit that line:
"print e"
You have *no* idea what e could be. It could be the number e... You can
now try to read through the above code and find out. And it's easy to do
that, Anyone can do that. But it takes time ! only 1 sec maybe but
that's still 1 sec, and when you are reveiewing code, it can be really
tedious.
Immagine now you hit
"print exception".
Then you know, he's trying to print an exception, do you need to care
about that ? If so introspect the code, try to know wich exception
class, but if the answer is 'I don't care about the exception being
printed' you can just continue and read the code like a book :) It saves
a lots of time.
Regarding another point you mentioned in this thread, your brain can
read "number" as fast as "num" so it doesn't take more time to read
proper english, than abreviations all around (I think it's the opposite
actually).
Your brain can instantly recognize a known face while it take a huge
amount of computation for a CPU to do so.
All I'm saying is that the brain is not reading a sequence of letters,
but recognize some known pattern as a whole, so reading time is not
related the word length.
JM
--
http://mail.python.org/mailman/listinfo/python-list