Emile van Sebille <em...@fenx.com> writes: > On 5/1/2009 7:31 AM J Kenneth King said... >> Chris Rebert <c...@rebertia.com> writes: >>> b = [] >>> for pair in a: >>> for item in pair: >>> b.append(item) >> >> This is much more clear than a nested comprehension. >> >> I love comprehensions, but abusing them can lead to really dense and >> difficult to read code. > > I disagree on dense and difficult, although I'll leave open the > question of abuse. > > b = [ item for pair in a for item in pair ] > > This is exactly the code above expressed in comprehension form.
If the comprehension above is an abuse, then every nested list comprehension is an abuse of comprehensions so they might as well not be in the language... -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list