Replies: 1 comment 2 replies
-
This is just completely unspecified behavior. The behavior with There will always be some ambiguity about what final exactly means here and what it applies to, but I think the current interpretation is the least likely to cause consistency issues, so I think the only reasonable way to extend class Foo:
x: Final = desc(lamda: ...)
@final
@desc
def y(self) -> int: ... Which is not what you want. But I think that if we want to be able to create descriptors that are settable but can't be overridden in subclasses we need a new, separate type qualifier. |
Beta Was this translation helpful? Give feedback.
-
My intuition is "yes", based on the behaviour of
@property
(mypy Playground, pyre Playground, Pyright playground):However, the type-checkers tested above don't seem to support custom final descriptors participating in instance assignments (mypy Playground, pyre Playground, Pyright Playground):
Beta Was this translation helpful? Give feedback.
All reactions