[issue40033] Just defined class missing from scope

Damian Yurzola report at bugs.python.org
Sat Mar 21 12:49:09 EDT 2020


New submission from Damian Yurzola <damian at yurzola.net>:

In the following example the last line throws as 'NameError: name 'Level1A' is not defined' for both 3.7 and 3.8

I assumed that Level1A should already be in scope while defining the insides of Level1B. But it isn't.
Is this a bug, or am I missing something?


from typing import List, Union


class Level0A:
    pass


class Level0B:
    class Level1A:
        subs: List[Level0A]

    class Level1B:
        subs: List[Level1A]

----------
components: Interpreter Core
messages: 364759
nosy: yurzo
priority: normal
severity: normal
status: open
title: Just defined class missing from scope
versions: Python 3.8

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


More information about the Python-bugs-list mailing list