Turn off ZeroDivisionError?
Grant Edwards
grante at visi.com
Sun Feb 10 16:57:39 EST 2008
On 2008-02-10, Jeff Schwab <jeff at schwabcenter.com> wrote:
> Neal Becker 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?
>
> Will the amount of time wasted by the software exceed the amount of time
> required to implement Python-level access to the hardware feature?
The "time required to implement Python-level access to the
hardware features" is simply the time required to delete the
lines of code that raise an exception when demon is 0.0
> At any rate, the work-around should at least let you work on
> the rest of the application, while a more efficient
> implementation can be developed.
A more efficient implementation? Just delete the code that
raises the exception and the HW will do the right thing.
--
Grant Edwards grante Yow! Do you need
at any MOUTH-TO-MOUTH
visi.com resuscitation?
More information about the Python-list
mailing list