For review: PEP 308 - If-then-else expression

Erik Max Francis max at alcyone.com
Sun Feb 9 02:36:49 EST 2003


Andrew Dalke wrote:

> My analysis suggests that this will, on average, make code
> about 0.04% smaller.  This was based on analyzing the number of
> time ?: is used in a large C++ codebase which was written by
> programmers of moderate experience and counting the times it was
> used appropriately (for C++), appropriately (if it was Python), and
> inappropriately (for either language).  It was used inappropriately
> more than it was used appropriately.

A strict analysis of how frequently a construct will be used shouldn't
be the sole deciding factor in whether or not it gets introduced into
the language.  After all, some programmers may find Booleans, or
lambdas, or list comprehensions, or generators, or metaclasses
unnecessary and use them very rarely, but that hardly means they
shouldn't have been added (even if you're in the group that thinks one
or all of those thigs shouldn't be added).

How much Python code really takes advantage of metaclasses?  I'd say not
much.  Does that mean that metaclasses shouldn't have been added?  No;
that's a totally unrelated issue.

> So while you may expect it to be useful for those cases, in normal
> practice it does not turn out to be the case.

Whether it's rare in and of itself (a debatable point) doesn't negate
that it would be useful in the situations where it's warranted.  Just
because I'm not apt to use generators all that often doesn't mean they
shouldn't be in the language.

This frequency metric for judging whether a feature is warranted is a
red herring, it seems to me.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ Always forgive your enemies -- nothing annoys them so much.
\__/ Oscar Wilde
    Bosskey.net: Quake III Arena / http://www.bosskey.net/q3a/
 A personal guide to Quake III Arena.




More information about the Python-list mailing list