Turn off ZeroDivisionError?

Grant Edwards grante at visi.com
Sun Feb 10 16:56:07 EST 2008


On 2008-02-10, Neal Becker <ndbecker2 at gmail.com> wrote:
> endangeredmassa at gmail.com wrote:
>
>> Would a wrapper function be out of the question here?
>> 
>> def MyDivision(num, denom):
>>     if denom==0:
>>         return "NaN"
>>     else
>>         return num / denom
>
> I bought a processor that has hardware to implement this.  Why do I want
> software to waste time on it?

Exactly.  Espeically when Python supposedly leaves floating
point ops up to the platform.

-- 
Grant Edwards                   grante             Yow!  Don't hit me!! I'm in
                                  at               the Twilight Zone!!!
                               visi.com            



More information about the Python-list mailing list