On Mon, May 3, 2021 at 6:49 PM Stestagg <stestagg@gmail.com> wrote:
class A:
    Namespace B:
        C = 1

A.__dict__ == {‘B.C’: 1, ‘B’: <namespace proxy>}

OK, that is a difference.  I don't really understand why it's desirable, but I see the difference.

I can make that happen with a metaclass that would allow:

class A(MagicNamespace):
    class B:
        C = 1

A.__dict__ == {'B.C': 1, 'B': <class 'module.B'>}

So that wouldn't be identical in the repr(), but is there something else important here?

In general, I find it anathema to add syntax for something that is easily handled by existing inheritance mechanisms.  If I want to, I can even make every class defined within the body of a MagicNamespace magically become a MagicNamespace too, if that's a thing someone wants.

Actually, I might not even need a metaclass, a MagicNamespace.__new__() method might be adequate. I haven't fully thought it out.

--
The dead increasingly dominate and strangle both the living and the
not-yet born.  Vampiric capital and undead corporate persons abuse
the lives and control the thoughts of homo faber. Ideas, once born,
become abortifacients against new conceptions.