On Jan 17, 2008 11:08 AM,  <[EMAIL PROTECTED]> wrote:
> On Jan 17, 4:59 pm, "Neil Cerutti" <[EMAIL PROTECTED]> wrote:
> > Generator expressions, unlike list comprehensions, have their own
> > scope so that they don't "leak" names to the enclosing scope. The
> > Python rule forbidding access to the locals of enclosing scopes is
> > preventing the class names from working in the generator expression.
>
> Ah, that explains why my random suggestion worked but was not
> helpful :) I feel like I am learning a lot today!

Me, too. Especially about wrongly oversimplifying stuff that's
complicated. My statement above isn't exactly right, since generator
expressions usually *can* access stuff in the enclosing local scope.
They wouldn't be very useful if they couldn't.

-- 
Neil Cerutti <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to