[Python-Dev] vox populii illiterati
Alex Martelli
aleax@aleax.it
Mon, 10 Feb 2003 08:27:12 +0100
On Monday 10 February 2003 03:06 am, Ka-Ping Yee wrote:
...
> It's not just that it's out of order -- it's that something gets
> short-circuited out of order. The whole idea of the very *first*
> thing you see getting short-circuited is unacceptably weird and
> unexpected for me.
Forms such as:
[ f(23) for f in stuff if callable(f) ]
have been in Python for years now, and you could indeed
say "the very first thing you see" (the call f(23)) is "getting
short-circuited" by an if-guard at the very end. If ternaries
had syntax similar to list comprehensions (but with
mandatory if and else clauses and no for clause, instead
of a mandatory for clause and optional further clauses),
as in:
[ f(23) if callable(f) else None ]
then people's familiarity with LCs (very popular constructs)
might help alleviate the "unexpectedness". (Pity about the
brackets where no lists nor indexing nor slicing are involved ).
Alex