Skip to content

Commit

Permalink
Add ExactType to experimental
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn authored Nov 10, 2024
1 parent 305c66f commit 6bb9c3d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions useful_types/experimental.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,11 @@ def __init_subclass__(cls):
"Use the @dataclass decorator to create dataclasses, "
"rather than subclassing dataclasses.DataclassLike"
)


# Based on: https://github.com/python/mypy/issues/8363#issuecomment-2462048345
class ExactType(Protocol[T]):
@property
def __class__(self, /) -> type[T]: ...
@__class__.setter
def __class__(self, t: type[T], /) -> None: ...

0 comments on commit 6bb9c3d

Please sign in to comment.