Hi Paul, I appreciate your explanation!
Thanx @ Paul Rubin wrote: > at <[EMAIL PROTECTED]> writes: >> > for x in (x for x in [-2, -1, 0, 1, 2, 3, 4] if x > 0): >> > ... more code ... > >> Do you know if this generates a new list internally (memory consumption?) > > It does not. That parenthesized expression is a called generator > expression. It compiles to a small subroutine, more or less, that > gets invoked repeatedly as you iterate through it. > > A similar expression with square brackets is called a list > comprehension and does generate a new list. -- http://mail.python.org/mailman/listinfo/python-list