do you master list comprehensions?
matthew.moss at gmail.com
Wed Dec 15 20:07:08 CET 2004
Diez B. Roggisch wrote:
> >>> data = [['foo','bar','baz'],['my','your'],['holy','grail']]
> >>> [e for l in data for e in l]
> ['foo', 'bar', 'baz', 'my', 'your', 'holy', 'grail']
Okay, I tried this in an interactive Python session and it works as
stated. My question is, why? How is the interpreter parsing that list
expression that it makes sense?
More information about the Python-list