Skip to content

Commit

Permalink
🎨 add repr to class
Browse files Browse the repository at this point in the history
  • Loading branch information
Henry committed Feb 24, 2024
1 parent ef6a336 commit b574e7f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/tutorial/tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@
"round(c2.radius, 3)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"c2 # repr"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
3 changes: 3 additions & 0 deletions src/mockup/mockup.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,6 @@ def diameter(self):
@classmethod
def from_circumference(cls, circumference: Union[int, float]) -> Self:
return cls(circumference / (2 * cls.PI))

def __repr__(self):
return f"Circle({self.radius})"

0 comments on commit b574e7f

Please sign in to comment.