Created
March 9, 2026 19:27
-
-
Save mypy-play/65f08b7cf3cd4c961da47a8c2a1eb4b2 to your computer and use it in GitHub Desktop.
Shared via mypy Playground
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from typing import Protocol, Self | |
| class FloatScalar[FloatT](Protocol): | |
| def pow(self, arg: FloatT) -> Self: ... | |
| def upcast(arg: FloatScalar[object]) -> FloatScalar[float]: | |
| return arg # ✅️ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment