I had the problem outside of a class body, in a normal function... (of course I can't build a minimal repro now. working on it.)
On 30 May 2014 15:37, Tim Diggins <t...@red56.co.uk> wrote: > Harry > *//excursus on the moan * > The problem with seems to be with scopes vs namespace differentiation > rather than comprehensions (though I haven't *actually* tried this in > python 3). So this problem only should occur in class bodies. And doing > heavy lifting stuff like comprehensions in a class body is a bit dangerous, > and you'd be better off doing it "properly" with a bit of metaprogramming > or wrapping it in function (which you could actually call in the body of > the module after class definition and then modify the class after creation) > > > > > On 30 May 2014 15:01, Harry Percival <harry.perci...@gmail.com> wrote: > >> Hi Uk-Pythoneers! >> >> *(with apologies to the wise ones amongst us who have chosen to live well >> away from the Big Smoke)* >> >> I'm involved in a couple of Python/TDD things in the next couple of >> weeks, both free to attend: >> >> >> Outside-In TDD and Test Isolation: >> https://skillsmatter.com/meetups/6410-outside-in-tdd-and-test-isolation-how-to-use-the-pain-of-horrible-mocks-to-drive-better-design >> (all about testing, isolation, mocking, and the pains thereof... it may >> to provide some insight into the #TDDisDead / DHH controversy, if you've >> been following that) >> >> Introduction to TDD workshop with Andrea Crotti: >> https://skillsmatter.com/meetups/6424-obey-the-testing-goat >> (a gentle introduction to TDD with Django, for anyone that can't make it >> to EuroPython this year) >> >> Hope they're of interest! >> >> HP >> >> PS Can I have a little moan about generator / list comprehension scoping >> in Python 3? I just ran into this: >> https://stackoverflow.com/questions/11669379/undefined-global-in-list-generator-expression-using-python3-works-with-python2 >> -- so now I can't use variables from the enclosing scope inside my >> comprehensions? that sucks! Doesn't it? >> >> >> >> >> -- >> ------------------------------ >> Harry J.W. Percival >> ------------------------------ >> Twitter: @hjwp >> Mobile: +44 (0) 78877 02511 >> Skype: harry.percival >> >> _______________________________________________ >> python-uk mailing list >> python-uk@python.org >> https://mail.python.org/mailman/listinfo/python-uk >> >> > -- ------------------------------ Harry J.W. Percival ------------------------------ Twitter: @hjwp Mobile: +44 (0) 78877 02511 Skype: harry.percival
_______________________________________________ python-uk mailing list python-uk@python.org https://mail.python.org/mailman/listinfo/python-uk