List comprehension vs filter()

Chris Angelico rosuav at gmail.com
Wed Apr 20 02:22:41 EDT 2011


On Wed, Apr 20, 2011 at 4:08 PM, Ian Kelly <ian.g.kelly at gmail.com> wrote:
> 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.

It's inside an if, but that's all. The body of the code has:

if len(lst):
    posttype=...
    lst=...

No other structural elements to get in the way - unless calling the
code as described is creating one.

Chris Angelico



More information about the Python-list mailing list