[Tutor] Possible with list comprehension?

Stewart Midwinter midtoad at yahoo.com
Mon Dec 25 07:25:48 CET 2006

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?

----- Original Message ----
From: Luke Paireepinart <rabidpoobear at gmail.com>
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.


Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20061224/03a9a4f2/attachment.html 

More information about the Tutor mailing list