Skip to content

Conversation

@peterwittek
Copy link

No description provided.

for i in xrange(N):
for j in xrange(N):
for k in xrange(N):
for i in range(N):
Copy link
Member

@kudkudak kudkudak Jan 20, 2017

Choose a reason for hiding this comment

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

This will slow down code for Python2. I would use range from six module (http://pythonhosted.org/six/) which defaults to xrange for Python2

Copy link
Author

Choose a reason for hiding this comment

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

Since we are talking about one single file where the xrange functions were replaced, we could simply do this:

try:
  range = xrange
except:
  pass

__author__ = 'kasiajanocha'

import numpy as np
from pykernels.base import Kernel, GraphKernel
Copy link
Member

Choose a reason for hiding this comment

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

If we decide to use relative imports, I would keep it consistent, i.e. also change pykernels.base import to .base

Copy link
Author

Choose a reason for hiding this comment

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

Fair enough, I don't have strong feelings either way, it is just the previous import scheme was broken in Python 3.

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.

2 participants