[Python-ideas] Statements vs Expressions... why?

Cliff Wells cliff at develix.com
Sun Sep 14 10:54:19 CEST 2008

On Sun, 2008-09-14 at 01:44 -0700, Cliff Wells wrote:

> I'm probably replying way too fast (in fact, I know I am), but I have
> two thoughts on this:
> 1) it seems to alter the semantics of "continue" too much when
> considered against current syntax, but...
> 2) with the new syntax, it seems not too bad because
> j = range(3)
> for i in j: i  # evaluates to []
> for i in j: continue # evaluates to []
> for i in j: continue i # evaluates to [0,1,2] 

Bah, I knew I was replying too fast.  I'm thinking that "continue" would
be redefined to mean "yield value and continue" which means that

for i in j: continue # evaluates to [ None, None, None ] not []

would seem the most consistent, but I fear it might be less practical
(as it would create problems trying to use for/continue inside other
expressions, although the effect when for/continue is used as a
statement remains fine).


> Overall I'm a bit torn on the idea.  Thoughts?
> Regards,
> Cliff
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas

More information about the Python-ideas mailing list