-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
Should decimal.Context.__delattr__
be in the stub?
#8504
Comments
Whatever the case, we should probably delete this orphaned comment, which was there to explain why Lines 201 to 202 in d7a5a14
|
Unlike Also unlike I propose that we add |
Sure, if there are semantic differences, we should add them back. |
@erictraut, if we added |
Pyright doesn't pay attention to the return type of If you want to reflect that If a class is designed to support arbitrary additions and deletions of attributes, then adding an explicit |
Thanks @erictraut! Let's leave |
#8483 by @sobolevn deleted
decimal.Context.__delattr__
from the stub, on the grounds that it had the exact same signature asbuiltins.object.__delattr__
.I think the rationale for this deletion was incorrect, as overriding
__delattr__
on a subclass can cause a type checker to give that class special semantics, even if the signature of__delattr__
is identical toobject.__delattr__
. For example:In the specific case of
Context.__delattr__
, however, I'm not sure whether it should be present in the stub or not. This is the behaviour you get at runtime:Maybe we could represent this by adding
Context.__delattr__
back to the stub and giving it the signaturedef __delattr__(self, __name: str) -> NoReturn
?The text was updated successfully, but these errors were encountered: