[Python-ideas] Statements vs Expressions... why?
cliff at develix.com
Thu Sep 11 19:40:29 CEST 2008
On Thu, 2008-09-11 at 10:44 -0400, Mike Meyer wrote:
> On Wed, 10 Sep 2008 15:39:49 -0700
> Cliff Wells <cliff at develix.com> wrote:
> > I strongly disagree. The artificial distinction between statements and
> > expressions is the definition of *inconsistent*. Why do we have two
> > versions of the "if" conditional? Why do we have "for" loops *and* list
> > comprehensions? They express the same ideas, but the limitations in one
> > required growing the language another direction.
> Because they are each more readable for the cases they handle. I
> initially didn't like list comprehensions. In practice, they're not
> very hard to write, and even easier to read. Doing away with for loops
> because we have them would force you to construct - and then
> immediately throw away - lists in the case where the for loop was
> being executed for side effects.
> There have been a number of similar proposals - I've even generated
> some. The general problem is that the results of embedding statements
> with important indentation into expressions is ugly. While I've seen a
> lot of words on this topic, I've seen very few concrete examples - and
> those seem to come as often from opponents to the idea as they do from
> So, how about some concrete examples? Show us translations of the
> various if statements and for loops, so we have something concrete to
> use to judge readability?
Several examples have already been posted in this thread (which has
probably gone on long enough).
Anyway, as was mentioned earlier, Logix very much resembles what I'm
More information about the Python-ideas