-
-
Notifications
You must be signed in to change notification settings - Fork 2
Description
I'd like to request codifying the existing behavior for how Any is handled as a base in the MRO of classes.
Links to PR & Discussion
PR: python/typing#1672
Discussion: https://discuss.python.org/t/take-2-rules-for-subclassing-any/47981
Current Type Checker Behaviors
The below has been edited after more testing surfaced that no type checker is completely consistent with this and that there is divergence between type checkers on behavior, see the tests added to the conformance suite in linked PR
- Currently, pyright and mypy and pytype support Any as a base class. None of the 3 are fully compliant with this wording, and each currently differ in behavior here.
- pyre does not yet support any as a base class.
- I'm unaware of other type checkers that have support for this at this time.
- This is also consistent with the behavior of
type[Any]
Controversial Issues
There are multiple reasonable interpretations of type theory leading to the current behavior, as well as alternative behavior, and it may or may not be beneficial to codify one of them at this time. The current changeset does not commit to a specific rationale for this.
The potential alternative behavior is more theory-pure and not something that had support within the discussion, being seen as too disruptive to users.