Skip to content

Commit 0e32dda

Browse files
committed
refactor(python/random): refactor shapes (wip)
1 parent f4b783f commit 0e32dda

File tree

3 files changed

+220
-167
lines changed

3 files changed

+220
-167
lines changed

binding/shapes_binding.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ void BindShapes(py::module &m) {
2323
.def("get_area", &Shape::GetArea)
2424
.def("get_perimeter", &Shape::GetPerimeter)
2525
.def("draw", &Shape::Draw)
26-
.def("get_name", [](const Shape &self) { return std::string{self.GetName()}; })
2726
.def("__str__", [](const Shape &self) { return std::string{self.GetName()}; })
2827
.def("__repr__", [](const Shape &self) {
2928
return std::format("<{} at {}>", self.GetName(), static_cast<const void *>(&self));

python/src/demo/containers.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -224,23 +224,11 @@ def transform(self, func: Callable[[T], U]) -> list[U]:
224224
return self._container.transform(func)
225225

226226
def __str__(self) -> str:
227-
"""String representation.
228-
229-
Returns
230-
-------
231-
str
232-
String representation of the container
233-
"""
227+
"""String representation."""
234228
return str(self._container)
235229

236230
def __repr__(self) -> str:
237-
"""String representation (for debugging).
238-
239-
Returns
240-
-------
241-
str
242-
String representation of the container
243-
"""
231+
"""String representation (for debugging)."""
244232
return repr(self._container)
245233

246234

0 commit comments

Comments
 (0)