[ python-Bugs-884841 ] Incorrect ZeroDivisionError message with __future__ division

SourceForge.net noreply at sourceforge.net
Sat Feb 21 03:43:58 EST 2004


Bugs item #884841, was opened at 2004-01-26 11:10
Message generated for change (Comment added) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=884841&group_id=5470

Category: Python Library
Group: Python 2.4
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: Gerrit Holl (gerrit)
Assigned to: Nobody/Anonymous (nobody)
Summary: Incorrect ZeroDivisionError message with __future__ division

Initial Comment:
>>> 1/0
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ZeroDivisionError: integer division or modulo by zero
>>> from __future__ import division
>>> 1/0
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ZeroDivisionError: float division

The latter is incorrect, or at least confusing, because
we aren't dividing floats, we're dividing integers.

----------------------------------------------------------------------

>Comment By: Raymond Hettinger (rhettinger)
Date: 2004-02-21 03:43

Message:
Logged In: YES 
user_id=80475

This may be a matter of perspective.  The whole point of
true division is to treat integer division arguments as
floating point.

----------------------------------------------------------------------

Comment By: Gerrit Holl (gerrit)
Date: 2004-01-26 11:19

Message:
Logged In: YES 
user_id=13298

Hmm, OK, my misunderstanding then. It is indeed confusing ;-)

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2004-01-26 11:14

Message:
Logged In: YES 
user_id=31435

But with __future__ division, int/int *is* float division.  
int//int (two slashes) is integer division then.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=884841&group_id=5470



More information about the Python-bugs-list mailing list