Skip to content

Commit e0b0061

Browse files
committed
extract complexity from docstring line
1 parent af6fc3e commit e0b0061

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

patterns/behavioral/strategy.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,8 @@ def apply_discount(self) -> float:
5555
return self.price - discount
5656

5757
def __repr__(self) -> str:
58-
return f"""
59-
<Order price: {self.price} with discount strategy: {getattr(self.discount_strategy, '__name__', None)}>
60-
"""
58+
strategy = getattr(self.discount_strategy, '__name__', None)
59+
return f"<Order price: {self.price} with discount strategy: {strategy}>"
6160

6261

6362
def ten_percent_discount(order: Order) -> float:

0 commit comments

Comments
 (0)