Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename xrange() to range() #16457

Closed
a-andre opened this issue Jun 7, 2014 · 22 comments
Closed

Rename xrange() to range() #16457

a-andre opened this issue Jun 7, 2014 · 22 comments

Comments

@a-andre
Copy link

a-andre commented Jun 7, 2014

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

CC: @jdemeyer @tscrim @a-andre @embray

Component: python3

Author: André Apitzsch, Frédéric Chapoton

Branch/Commit: dd549fa

Reviewer: Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/16457

@a-andre a-andre added this to the sage-6.3 milestone Jun 7, 2014
@a-andre
Copy link
Author

a-andre commented Jun 7, 2014

New commits:

d3bae80rename xrange() to range()

@a-andre
Copy link
Author

a-andre commented Jun 7, 2014

Author: André Apitzsch

@a-andre
Copy link
Author

a-andre commented Jun 7, 2014

Commit: d3bae80

@a-andre
Copy link
Author

a-andre commented Jun 7, 2014

Branch: u/aapitzsch/ticket/16457

@videlec
Copy link
Contributor

videlec commented Jun 8, 2014

comment:2

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.

@kcrisman
Copy link
Member

comment:3

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.

@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@jdemeyer jdemeyer removed this from the sage-6.4 milestone Aug 25, 2014
@fchapoton
Copy link
Contributor

comment:8

see #21375 for a step in this direction

@fchapoton fchapoton added this to the sage-7.4 milestone Aug 30, 2016
@fchapoton fchapoton removed the pending label Aug 30, 2016
@fchapoton
Copy link
Contributor

comment:10

NOTE: xrange can (and should) stay inside the code of .pyx files

@fchapoton

This comment has been minimized.

@fchapoton
Copy link
Contributor

comment:11

see #21478, #21530, #21531, #21548 for some further steps

@fchapoton
Copy link
Contributor

comment:12

after #21763, #21751, #21677 we will be almost done

@fchapoton
Copy link
Contributor

comment:13

This is now essentially done. There remains only very few xrange in the code. Let us get rid of them here if possible.

@fchapoton
Copy link
Contributor

Changed commit from d3bae80 to none

@fchapoton
Copy link
Contributor

Changed branch from u/aapitzsch/ticket/16457 to none

@fchapoton
Copy link
Contributor

Commit: dd549fa

@fchapoton
Copy link
Contributor

comment:14

ok, here is a simple branch eliminating essentially all the remaining instances of xrange, mostly in the doc.

There will remain to handle ticket #16081.


New commits:

dd549fatrac 16457 eliminate last traces of xrange

@fchapoton
Copy link
Contributor

Branch: u/chapoton/16457

@fchapoton
Copy link
Contributor

comment:15

at least one bot is green, please review

@fchapoton
Copy link
Contributor

comment:16

ping ?

@tscrim
Copy link
Collaborator

tscrim commented Dec 2, 2016

Changed author from André Apitzsch to André Apitzsch, Frédéric Chapoton

@tscrim
Copy link
Collaborator

tscrim commented Dec 2, 2016

Reviewer: Travis Scrimshaw

@vbraun
Copy link
Member

vbraun commented Dec 5, 2016

Changed branch from u/chapoton/16457 to dd549fa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants