On 12/25/06, Stewart Midwinter <[EMAIL PROTECTED]> wrote:

 hmm, maybe you're right.  I certainly agree that your example is nested
and mine is not.  I wonder what the exact description of Kent's solution is?


http://docs.python.org/tut/node7.html states:
Each list comprehension consists of an expression followed by a for clause,
then zero or more for or if clauses. The result will be a list resulting
from evaluating the expression in the context of the for and if clauses
which follow it.

So I guess it just counts as a single list comprehension.
HTH,
-Luke

 ----- Original Message ----
From: Luke Paireepinart <[EMAIL PROTECTED]>
 I don't think this is a 'nested list comprehension.'
I think that would be
c = 'Hello, World!'
[a for a in [b for b in c]]
in other words: a list comprehension inside of a list comprehension.

Whereas this example is a single list comprehension because it only builds
one list, despite having multiple 'for' loops.
-Luke



__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to