Skip to content

Commit

Permalink
Add __slots__ to Maybe subclasses
Browse files Browse the repository at this point in the history
  • Loading branch information
HKGx committed Oct 18, 2023
1 parent be96ca2 commit 9ad8674
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions perhaps/maybe.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@


class Maybe[T](ABC):
__slots__ = ()

value: Union[T, NoReturn]

@abstractmethod
Expand Down Expand Up @@ -202,6 +204,7 @@ def __repr__(self) -> str:

class Just[T](Maybe[T]):
__match_args__ = ("value",)
__slots__ = ("value",)

value: T

Expand Down Expand Up @@ -296,6 +299,7 @@ def __repr__(self) -> str:

class Nothing[T](Maybe[T]):
__match_args__ = ()
__slots__ = ()

instance: Optional["Nothing[T]"] = None

Expand Down

0 comments on commit 9ad8674

Please sign in to comment.