[ python-Bugs-1005325 ] inconsistent acceptance of floats for
range()
SourceForge.net
noreply at sourceforge.net
Tue Aug 17 04:17:28 CEST 2004
Bugs item #1005325, was opened at 2004-08-07 17:13
Message generated for change (Comment added) made by bcannon
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1005325&group_id=5470
Category: Python Interpreter Core
Group: Python 2.3
>Status: Closed
>Resolution: Wont Fix
Priority: 4
Submitted By: Brett Cannon (bcannon)
Assigned to: Nobody/Anonymous (nobody)
Summary: inconsistent acceptance of floats for range()
Initial Comment:
``range(1.0)`` will raise a DeprecationWarning (thanks to
PyArg_ParseTuple() warning when a float is passed when an
integer is expected), but if you do ``range(1e100)`` it raises a
TypeError saying that an "integer end argument expected, got
float". Obviously not consistent.
----------------------------------------------------------------------
>Comment By: Brett Cannon (bcannon)
Date: 2004-08-16 19:17
Message:
Logged In: YES
user_id=357491
OK, works for me.
----------------------------------------------------------------------
Comment By: Dave Watson (docwatson)
Date: 2004-08-13 20:49
Message:
Logged In: YES
user_id=1094771
I've looked into it, and 1e100 is of type 'long float'
internally, which uses a different range function
(handle_range_long) instead of 1.0 which is a normal float,
which uses the standard range function (bltin_range).
It seems the long version was written after the standard
one, and once the deprecation warning (which happens in both
versions, but it will only print once per session, restart
python to test each) is turned into an error, things will be
consistent.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1005325&group_id=5470
More information about the Python-bugs-list
mailing list