Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@cclauss
Copy link

@cclauss cclauss commented Feb 18, 2018

PR Summary

As part of dropping support for Python 2, we can simplify the code by:

  • removing all instances from six.moves import xrange and
  • converting all calls to xrange() into calls to range().

Copy link
Member

@jklymak jklymak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks this seems fine. I assume you did a grep for all instances of xrange...

@efiring
Copy link
Member

efiring commented Feb 19, 2018

See #10526 for the solution to the problem with _axes.py.

s_len = 0
# todo: use Alex's xrange pattern from the cbook for efficiency
for (word, ind) in zip(seq, xrange(len(seq))):
for (word, ind) in zip(seq, range(len(seq))):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these functions should just be deleted as they have been deprecated since 2.1

return True
val = seq[0]
for i in xrange(1, len(seq)):
for i in range(1, len(seq)):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

X, Y = np.meshgrid(x, y)
if self.orientation == 'vertical':
xy = [list(zip(X[i], Y[i])) for i in xrange(N)]
xy = [list(zip(X[i], Y[i])) for i in range(N)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably better written using np.stack or a variant of it

# iterate until we find previous character, needed for cases
# such as ${ -2}$, $ -2$, or $ -2$.
for i in six.moves.xrange(1, loc + 1):
for i in range(1, loc + 1):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

already refactored in the py3mathtext PR

for i, code_piece in enumerate(code_pieces):
images = []
for j in xrange(1000):
for j in range(1000):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably should be itertools.count()...

# simpler than making them into arrays.
if self.orientation == 'vertical':
return [list(zip(X[i], Y[i])) for i in xrange(1, N-1)]
return [list(zip(X[i], Y[i])) for i in range(1, N-1)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above re np.stack

@tacaswell tacaswell added this to the v3.0 milestone Feb 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants