MCPcopy Create free account
hub / github.com/dabeaz-course/python-mastery / __repr__

Method __repr__

Solutions/5_2/stock.py:11–13  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

9 self.price = price
10
11 def __repr__(self):
12 # Note: The !r format code produces the repr() string
13 return f'{type(self).__name__}({self.name!r}, {self.shares!r}, {self.price!r})'
14
15 def __eq__(self, other):
16 return isinstance(other, Stock) and ((self.name, self.shares, self.price) ==

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected