Having __slots__ in a class causes invariance #11244
Unanswered
CrowdingFaun624
asked this question in
Q&A
Replies: 1 comment
-
|
This looks like a bug to me. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
When defining a class, its type variables become invariant whenever attributes involving it are in
__slots__. This is demonstrated by my examples:I can't think of a reason for why this would be.
argis immutable whether it is in__slots__or not, so it should always be covariant. This is pretty annoying for my code, since I like using__slots__.Beta Was this translation helpful? Give feedback.
All reactions