-
Notifications
You must be signed in to change notification settings - Fork 38
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
Python 3 compatibility improved #6
base: master
Are you sure you want to change the base?
Conversation
for i in xrange(N): | ||
for j in xrange(N): | ||
for k in xrange(N): | ||
for i in range(N): |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
@@ -8,7 +8,7 @@ | |||
from pykernels.base import Kernel, GraphKernel |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
No description provided.