[issue40033] Just defined class missing from scope

Raymond Hettinger report at bugs.python.org
Mon Mar 23 14:21:56 EDT 2020


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

> I assumed that Level1A should already be in scope while defining 
> the insides of Level1B. But it isn't.

That analysis is correct.  Class namespaces don't nest like functions do.  The "enclosing" namespace is globals, not the surrounding class.

This isn't a bug, but it is understandable why you might assume otherwise.

----------
nosy: +rhettinger
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40033>
_______________________________________


More information about the Python-bugs-list mailing list