-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Double underscore name mangling in classes to allow independent types #523
Comments
A simple example, exposing the behavior:
|
That looks intentional. You shouldn't be accessing private attributes like that. |
@gvanrossum in production code not. But in tests you sometimes need to access the internal state of the object to validate what happened. |
You can use |
@JukkaL, yes, but it's less readable |
The fact of the matter is that |
Thank you for your encouragement. You should just use |
As @JukkaL mentioned the original issue is not about allowing class B:
__foo: int
class C(B):
__foo: str which is type safe but currently prohibited. |
Ouch, sorry, I read too quickly. |
I'm looking at this one. |
Mypy should perform name mangling in classes.
The text was updated successfully, but these errors were encountered: