Need help with Python scoping rules

Terry Reedy tjreedy at
Thu Aug 27 09:26:31 CEST 2009

kj wrote:

> I think I understand the answers well enough.  What I *really*
> don't understand is why this particular "feature" of Python (i.e.
> that functions defined within a class statement are forbidden from
> "seeing" other identifiers defined within the class statement) is
> generally considered to be perfectly OK.  IMO it's a bizarre,
> inexplicable blindspot (which, among other things, gives rise to
> a certain worry about what other similar craziness lurks under
> Python's image of rationality).  I have never seen even a half-hearted
> justification, from a language design point of view, for why this
> particular "feature" is worth having.  Maybe some day the BDFL will
> deign to give one.

I attempted to give an explanation in my previous post.

More information about the Python-list mailing list