Opened 8 years ago
Closed 6 years ago
#16457 closed enhancement (fixed)
Rename xrange() to range()
Reported by: | aapitzsch | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-7.5 |
Component: | python3 | Keywords: | python3 |
Cc: | jdemeyer, tscrim, aapitzsch, embray | Merged in: | |
Authors: | André Apitzsch, Frédéric Chapoton | Reviewers: | Travis Scrimshaw |
Report Upstream: | N/A | Work issues: | |
Branch: | dd549fa (Commits, GitHub, GitLab) | Commit: | dd549fa80f073333fb53fe8d0634eb19281475e6 |
Dependencies: | Stopgaps: |
Description (last modified by )
In python3 xrange() was renamed to range().
With this patch iterators will become lists till we switch to python 3. But this should be okay for small intervals. (That's the reason for not changing all.)
This is part of #16081.
NOTE: xrange can (and should) stay inside the code of .pyx files
Change History (18)
comment:1 Changed 8 years ago by
- Branch set to u/aapitzsch/ticket/16457
- Commit set to d3bae80fba004f3a633c3e0759293a61854f0208
- Keywords python3 added
- Status changed from new to needs_review
comment:2 Changed 8 years ago by
I am strongly against that this ticket is being merge now. We are far from having the Python 3 switch tomorrow (is it even a blocker for sage-6.3?). It will slow down everything. xrange
is faster by 40% on lists of size 100:
sage: timeit("for i in xrange(100):\n for j in xrange(100): pass") 625 loops, best of 3: 362 µs per loop sage: timeit("for i in range(100):\n for j in range(100): pass") 625 loops, best of 3: 501 µs per loop
And there are many of them in Sage source code.
comment:3 Changed 8 years ago by
Yeah, this does seem somewhat premature due to this. However, it's still good to have a trial version here, especially if someone decided to make a 'Sage-py3' branch for testing at some point.
comment:4 Changed 8 years ago by
- Milestone changed from sage-6.3 to sage-6.4
comment:5 Changed 8 years ago by
- Milestone changed from sage-6.4 to sage-pending
comment:6 Changed 8 years ago by
- Status changed from needs_review to needs_work
comment:7 Changed 6 years ago by
- Component changed from misc to python3
comment:8 Changed 6 years ago by
see #21375 for a step in this direction
comment:9 Changed 6 years ago by
- Milestone changed from sage-pending to sage-7.4
comment:10 Changed 6 years ago by
- Description modified (diff)
NOTE: xrange can (and should) stay inside the code of .pyx files
comment:11 Changed 6 years ago by
comment:12 Changed 6 years ago by
comment:13 Changed 6 years ago by
- Branch u/aapitzsch/ticket/16457 deleted
- Commit d3bae80fba004f3a633c3e0759293a61854f0208 deleted
This is now essentially done. There remains only very few xrange in the code. Let us get rid of them here if possible.
comment:14 Changed 6 years ago by
- Branch set to u/chapoton/16457
- Cc jdemeyer tscrim aapitzsch embray added
- Commit set to dd549fa80f073333fb53fe8d0634eb19281475e6
- Milestone changed from sage-7.4 to sage-7.5
- Status changed from needs_work to needs_review
comment:15 Changed 6 years ago by
at least one bot is green, please review
comment:16 Changed 6 years ago by
*ping* ?
comment:17 Changed 6 years ago by
- Reviewers set to Travis Scrimshaw
- Status changed from needs_review to positive_review
comment:18 Changed 6 years ago by
- Branch changed from u/chapoton/16457 to dd549fa80f073333fb53fe8d0634eb19281475e6
- Resolution set to fixed
- Status changed from positive_review to closed
New commits:
rename xrange() to range()