[Python-ideas] string codes & substring equality

Mark Lawrence breamoreboy at yahoo.co.uk
Mon Dec 2 02:45:30 CET 2013


On 02/12/2013 01:07, MRAB wrote:
> On 02/12/2013 00:21, Guido van Rossum wrote:
>> On Sun, Dec 1, 2013 at 4:02 PM, Steven D'Aprano
>> <steve at pearwood.info
>> <mailto:steve at pearwood.info>> wrote:
>>
>>
>>     I'm reminded of a joke. What's 9/2?
>>
>>     The mathematician says it's 4.5. The scientist says it's 4.5 ±
>> 0.1. The
>>     engineer says it's between 4 and 5, but we'll call it 6 to be on the
>>     safe side.
>>
>>
>> I think you missed one. The programmer says it's 4. :-)
>>
> No. The programmer used to say it was 4, but now says it's 4.5, give or
> take a little rounding error. :-)
>

The newbie says it should be 4.5 but gets 4.499999999999999999999 so 
raises issue on bug tracker stating that Python can't do arithmetic 
properly.

In [5]: 9/2
Out[5]: 4.5

Blast, lousy example :)

-- 
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence



More information about the Python-ideas mailing list