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

Method total

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

Source from the content-addressed store, hash-verified

54 promotion: Optional[Callable[['Order'], Decimal]] = None # <1>
55
56 def total(self) -> Decimal:
57 totals = (item.total() for item in self.cart)
58 return sum(totals, start=Decimal(0))
59
60 def due(self) -> Decimal:
61 if self.promotion is None:

Calls 1

sumFunction · 0.85