This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: make range be xrange
Type: Stage:
Components: Interpreter Core Versions: Python 3.0
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: nnorwitz Nosy List: gvanrossum, nnorwitz, twouters
Priority: normal Keywords: patch

Created on 2006-04-18 22:40 by twouters, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
p3yk.range.diff twouters, 2006-04-18 22:41
xrange.diff nnorwitz, 2007-02-27 05:18 v1 - updated, checkpoint
Messages (4)
msg50070 - (view) Author: Thomas Wouters (twouters) * (Python committer) Date: 2006-04-18 22:40
As discussed (in private email), make range an alias
for xrange and see howmuch breaks ;)

Aside from Python/bltinmodule.c, 31 files had to be
changed: 3 modules (but one of them was a doctest in
doctest), 2 test output files (for profile and
cProfile), and 26 tests. The predominant breakage in
tests was due to tests using range() to express
expected-test-output, and comparing it with the output
list. Another fair sized portion (particularly of
doctests, and including the doctest in doctest itself
that had to be updated) broke because of reliance on
the repr of range(). Only a few tests broke because of
xrange() being immutable (mostly tests that were
actually testing list-behaviour, like item- and
slice-assignment, on a list created by range()), but
that were all two real breakages in actual modules. The
only place that broke because xrange can't handle longs
was the test for range() that tested whether it'd take
longs. Overall, ~185 lines had to be changed.

The patch still breaks a test: the test to see if
range() does proper checks on its arguments (using the
'badint' class in test_builtin.) I didn't fix it to
remind myself that xrange() should be made to operate
on longs :) (It currently fails because xrange() will
turn all its arguments into C long integers before it
does any checks.)
msg50071 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2006-08-26 20:20
Logged In: YES 
user_id=6380

For Neal to close when his range/xrange patch is uploaded.
msg50072 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2006-12-28 01:39
Ping?
msg50073 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2007-02-27 05:18
Updating a checkpoint which patches everything in the library.  Also has a non-working version of xrange.  I haven't ported this from 2.6 to the int/long unification.  This is just in case my laptop crashes.  Hopefully I'll finish this up tomorrow and check in.

Most of the tests pass.  There are only a few issues AFAIK, like test_xrange (big surprise) and test_repr.  Basically the longs aren't done.  I'm not sure about floats.  Floats should be rejected in 3k.
File Added: xrange.diff
History
Date User Action Args
2022-04-11 14:56:16adminsetgithub: 43244
2008-01-06 22:29:46adminsetkeywords: - py3k
versions: + Python 3.0
2006-04-18 22:40:59twouterscreate