[New-bugs-announce] [issue4104] Namespace inconsistency

Antoine d'Otreppe report at bugs.python.org
Fri Oct 10 23:35:36 CEST 2008

New submission from Antoine d'Otreppe <a.dotreppe at gmail.com>:


See the following code and comments for explanation ;) (Try it with
interactive mode)

>>> class A:
...     class B:
...         pass

>>> A
<class __main__.A at 0x...>
>>> A.B
<class __main__.B at 0x...>
>>> B
NameError: B is not defined

This seems to be inconsistent, as Python represents A.B as __main__.B,
but B is not accessable from __main__

Maybe this could be better:
>>> A.B
<class __main__.A.B at 0x...>

components: Interpreter Core
messages: 74648
nosy: Antoine d'Otreppe
severity: normal
status: open
title: Namespace inconsistency
type: feature request
versions: Python 2.5

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list