Re: Turn off ZeroDivisionError?
- From: Ben Finney <bignose+hates-spam@xxxxxxxxxxxxxxx>
- Date: Mon, 11 Feb 2008 09:50:07 +1100
Mark Dickinson <dickinsm@xxxxxxxxx> writes:
On Feb 10, 3:29 pm, Grant Edwards <gra...@xxxxxxxx> wrote:
platform does". Except it doesn't in cases like this. All my
platforms do exactly what I want for division by zero: they
generate a properly signed INF. Python chooses to override
that (IMO correct) platform behavior with something surprising.
Python doesn't generate exceptions for other floating point
"events" -- why the inconsistency with divide by zero?
But not everyone wants 1./0. to produce an infinity; some people
would prefer an exception.
Special cases aren't special enough to break the rules.
Most people would not want this behaviour either::
>>> 0.1
0.10000000000000001
But the justification for this violation of surprise is "Python just
does whatever the underlying hardware does with floating-point
numbers". If that's the rule, it shouldn't be broken in the special
case of division by zero.
--
\ “If the desire to kill and the opportunity to kill came always |
`\ together, who would escape hanging?” —Mark Twain, _Following |
_o__) the Equator_ |
Ben Finney
.
- Follow-Ups:
- Re: Turn off ZeroDivisionError?
- From: Mark Dickinson
- Re: Turn off ZeroDivisionError?
- From: Grant Edwards
- Re: Turn off ZeroDivisionError?
- From: Carl Banks
- Re: Turn off ZeroDivisionError?
- References:
- Turn off ZeroDivisionError?
- From: Neal Becker
- Re: Turn off ZeroDivisionError?
- From: Mark Dickinson
- Re: Turn off ZeroDivisionError?
- From: Grant Edwards
- Re: Turn off ZeroDivisionError?
- From: Mark Dickinson
- Turn off ZeroDivisionError?
- Prev by Date: Re: Turn off ZeroDivisionError?
- Next by Date: Re: Turn off ZeroDivisionError?
- Previous by thread: Re: Turn off ZeroDivisionError?
- Next by thread: Re: Turn off ZeroDivisionError?
- Index(es):