[Python Wpg] Fwd: Cannot figure out this ZeroDivisionError exception

Mike pfaiffer high.res.mike at gmail.com
Sat Mar 12 00:30:07 EST 2011


On 11-03-11 7:22 PM, Chris Macksey wrote:
> On 11 March 2011 18:38, Mike pfaiffer<high.res.mike at gmail.com>  wrote:
>
>>
>>         Just a thought. Would scale = 1/300 not produce 0 instead of the
>> floating point 0.00333? It looks like you may have a data type conversion
>> issue. If the numerator is an integer then the result of the division will
>> be an integer. I was caught by this a couple of times (and will no doubt be
>> caught by it again in the future).
>>
>>                                 Later
>>                                 Mike
>>
>>
>
> Yes, it would, depending on your Python version - unless you either use from
> __future__ import division  to get the new division semantics, or use
> 1.0/300 (or equivalent) to force it to be a float.
>
> Cheers,
>
> Chris.

	That's the way it worked out on my Mac. I couldn't test it on my Linux 
box because of hardware issues.

				Later
				Mike




More information about the Winnipeg mailing list