code not true?

Mark Hammond mhammond at skippinet.com.au
Sat Apr 22 10:02:21 EDT 2000


"Grant Edwards" <nobody at nowhere.nohow> wrote in message
news:M3iM4.518$wJ1.17829 at ptah.visi.com...

> This seems to be something that we were all told as freshmen
> but stumble over later anyway.  One wonders if a safe language
> intended for use by beginners should even have an equality
> operator for floating point objects.

Of all the solutions to this problem, this does strike me as one of the
best - simply remove equality testing al together for floating point:

>>> 1.0==1.0
Traceback (whatever it says today)
File <etc etc> in ?
Floating points numbers cant be compared.
In fact, life would be better if you could pretend they didnt even exist.
Dont even ask.  You were warned.


Mark.





More information about the Python-list mailing list