From: Paul Prescod Date: 2001-07-30T13:02:54+09:00 Subject: [ruby-talk:18781] Re: Ruby as opposed to Python? "Florian G. Pflug" wrote: > > ... > > If you write a function, which depends on 1/2 being 0.5, why don't you just > write a.to_f / b.to_f? Yes, that's a workaround. #1. What if your algorithm is also supposed to work for complex numbers? #2. It is somewhat ugly to do a type conversion just to guard against a flaw in the language. #3. Programmers (especially new programmers, who haven't been bitten by the bug) will often forget to do this. In my opinion, either integers should be substitutable for floats or should not be. In Python and Ruby they are "almost", "mostly", "usually" substitutable. That is an accident waiting to happen and it does happen pretty often. In C, Perl and (future) Python3, integers will be fully substitutable for floats. -- Take a recipe. Leave a recipe. Python Cookbook! http://www.ActiveState.com/pythoncookbook