Special methods #20

Merged
paris-ci merged 6 commits from special_methods into 2.0 2021-09-01 02:27:33 +00:00
Showing only changes of commit 9d1df65af3 - Show all commits

View File

@@ -141,6 +141,10 @@ class Role(Hashable):
Returns the role's name.
.. describe:: str(x)
Returns the role's ID.
Attributes
----------
id: :class:`int`
@@ -195,6 +199,9 @@ class Role(Hashable):
def __str__(self) -> str:
return self.name
def __int__(self) -> int:
return self.id
def __repr__(self) -> str:
return f'<Role id={self.id} name={self.name!r}>'