mirumee / prices

Python price handling for humans.
Other
268 stars 39 forks source link

Add suport for list comprehensions #8

Closed artursmet closed 10 years ago

artursmet commented 10 years ago

Fixed TypeError when using sum([price1, price2]).

patrys commented 10 years ago

Not going to work. Use sum() properly and pass a zero object as its second parameter:

zero = Price(0, currency='USD')
print(sum([Price(10, currency='USD'), Price(20, currency='USD')], zero))

Otherwise you can add just about anything to a price:

print('IMMA CHARGIN MAH LAZER!!!' + Price(10, currency='BTC'))