[Python-Dev] Re: Structural pattern matching and mangling private names

2022年6月15日 13:09:29 -0700

I don't remember this topic ever being discussed, but still I wouldn't
expect that __something to be mangled, given that it refers to an attribute
of an instance of D.
I might expect that in a "case D(something=__y)" you get the mangling for
__y, but I'm not sure what the implementation does now and I'm writing from
my phone
On 2022年6月15日, 20:12 , <[email protected]> wrote:
> For this code:
>
> class C:
> def f(self, x):
> match x:
> case D(__something=y):
> return y
>
> It appears that the name "__something" isn't mangled. Under most other
> circumstances I'd expect this to be mangled to "_C__something". Is this:
> * intentional,
> * accidental, but how that it's done it's the defined behaviour,
> * or a defect?
>
> It doesn't seem like it's explicitly tested for in test_patma.py either
> way.
>
> Thanks
> David
> _______________________________________________
> Python-Dev mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://mail.python.org/mailman3/lists/python-dev.python.org/
> Message archived at
> https://mail.python.org/archives/list/[email protected]/message/LILLO3MBTVY6ZQT3VNUVXATEPS3ASGQF/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/335CR2QTKIP6DLVDCIEAGRKKQW6EU6WK/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to