Inline Conditionals?

Alex Martelli aleaxit at yahoo.com
Mon Sep 6 03:24:05 EDT 2004


Martin Maney <maney at pobox.com> wrote:

> Alex Martelli <aleaxit at yahoo.com> wrote:
> > Paul Rubin <http://phr.cx@NOSPAM.invalid> wrote:
> >> more readable and harder to get wrong, unlike your sparse example,
> >> which has 'foo' on both branches of the conditional where you meant
> >> 'foo' and 'bar'.
> 
> > ....as several people already noticed, proving the great readability of
> > the sparse way of expressing oneself...
> 
> Amazing.  If a typo slips into something you dislike then you cite that
> as proof of how bad it is.  When it happens to you while showing off
> your preferred form, it becomes, by prestidigitation, proof of how good
> that is.  Clearly this is determined by nothing at all like logic.

It's not the typo that "becomes proof" (or, rather, indication) of the
higher readability of sparse expression: it's the fact that so many
readers noticed it and let me know, privately or publically.  Why do you
think it's illogical to observe that?  Typos and other errors are easier
to see when they're part of very readable code than when they're part of
dense, obfuscated code -- seems perfectly logical to me.

Anything that requires the same name (or whatever) to be entered more
than once can be subject to more typos than a form in which you enter
the information only once -- ameliorating which is a better chance for a
human reader to catch a typo due to the redundancy (while if the info is
entered only once there is no such redundancy and any catch needs to be
based on deeper understanding).  This might be relevant, say, when
discussing <name> += <value> vs <name> = <name> + <value> -- when <name>
is sufficiently complicated the second form may have such issues which
the first one avoids, and there's no real chance of introducing a short,
simple temporary name to ameliorate things.  This is not quite germane
to the discussion at hand, though.


Alex



More information about the Python-list mailing list