Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • TypeError: 'generator' object is unsubscriptable
    – Josh Lee
    Commented Mar 2, 2010 at 8:42
  • My bad, should be list comprehension not a generator, fixed... thanks! :)
    – Mizipzor
    Commented Mar 2, 2010 at 8:54
  • 4
    There is no reason to evaluate the whole iterable (which may not be possible). It is more robust and efficient to use one of the other solutions provided. Commented Mar 2, 2010 at 16:55