[Python-ideas] Fixing class scope brainstorm

Guido van Rossum guido at python.org
Sun Mar 25 11:50:03 EDT 2018

In the PEP 572 threads there's some grumbling about class scopes.

Here's a random brainstorm. How about we change the scoping rules so that
only functions defined with 'def' (or inside one of those) cannot see the
class scope, and comprehensions and lambdas treat the class scope as an
outer scope so they can close over class variables?

Not sure what should happen to nested classes, they should probably be
lumped in with the 'def' scopes.

--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180325/c8766162/attachment.html>

More information about the Python-ideas mailing list