List comprehension vs filter()

Ian Kelly ian.g.kelly at gmail.com
Wed Apr 20 02:08:03 EDT 2011


On Tue, Apr 19, 2011 at 9:59 PM, Chris Angelico <rosuav at gmail.com> wrote:
> On Wed, Apr 20, 2011 at 1:45 PM, Chris Rebert <clp2 at rebertia.com> wrote:
>> Built-ins aren't quite the same as globals, but essentially yes:
>
> Sure. That might explain some of the weirdness, but it doesn't explain
> why things were still weird with the variable named posttype. However,
> since the list comp appears to work, I'm going with that... would love
> to know what's going on, but at least things aren't utterly b0rked
> like they were two hours ago!

What is the scope the code is running in?  If this is part of a class
definition, that could explain why the lambda is not seeing the type /
posttype closure: because there isn't one.

Cheers,
Ian



More information about the Python-list mailing list