On Sun, 2 May 2021 at 00:57, Matt del Valle <[email protected]> wrote:

> Hi all!
>
> So this is a proposal for a new soft language keyword:
>
> namespace
>
> …
> - any name bound within the namespace block is bound in exactly the same
> way it would be bound if the namespace block were not there, except that
> the namespace's name and a dot are prepended to the key when being inserted
> into the module/class/locals dict.
>

Sometimes it’s useful to write classes that are similar to:

class proxy:
    ….
    def __getattr__(self, name):
         return wrap(getattr(self.object, name))

How would this pattern interact with objects that use namespaces? I’m
guessing the interpreter wouldn’t know to call getattr with ‘ns.attr’
rather than just ‘ns’?

Steve

>
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/OXZ5KSNCYNHBEIHOJNBSK4JZS2WJJ7OR/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to