[python-uk] TDD stuff in London, next two weeks (and list comprehension scoping)

Sven Marnach smarnach at google.com
Fri May 30 17:07:36 CEST 2014


On 30 May 2014 15:49, Harry Percival <harry.percival at gmail.com> wrote:

> I had the problem outside of a class body, in a normal function...
>

The particular problem mentioned in the StackOverflow quesiton you linked
only ever occurs inside class bodies.  They are the only enclosing scopes
that are skipped in name lookups.  You can still access class attributes of
the class by using ClassName.attribute inside the list comprehension, like
you would have to do to access class attributes from inside methods.

Cheers,
    Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-uk/attachments/20140530/4a23f822/attachment-0001.html>


More information about the python-uk mailing list