Python is DOOMED! Again!

Steven D'Aprano steve+comp.lang.python at pearwood.info
Fri Jan 23 05:59:40 EST 2015


Chris Angelico wrote:

> On Fri, Jan 23, 2015 at 1:16 AM, Steven D'Aprano
> <steve+comp.lang.python at pearwood.info> wrote:
>> Mario Figueiredo wrote:
>>
>>> def handle_employees(emp: Union[Employee, Sequence[Employee]], raise:
>>> Union[float, Sequence[float]]) -> Union[Employee, Sequence[Employee],
>>> None]:
>>
>> Using
>> floats for money is Just Wrong and anyone who does so should have their
>> licence to program taken away.
> 
> But using a float to specify a percentage raise that an employee (or
> class of employees) gets would be reasonable. 

I don't think that a raise of 0.10000000000000001 (10%),
0.035000000000000003 (3.5%) or 0.070000000000000007 (7%) is quite what
people intended.

:-)

(Don't use binary floating point numbers for anything related to money. Just
don't.)


-- 
Steven




More information about the Python-list mailing list