MCPcopy
hub / github.com/fluentpython/example-code-2e / due

Method due

10-dp-1class-func/strategy.py:60–65  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

58 return sum(totals, start=Decimal(0))
59
60 def due(self) -> Decimal:
61 if self.promotion is None:
62 discount = Decimal(0)
63 else:
64 discount = self.promotion(self) # <2>
65 return self.total() - discount
66
67 def __repr__(self):
68 return f'<Order total: {self.total():.2f} due: {self.due():.2f}>'

Calls 1

totalMethod · 0.95