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

NameError: name 'xrange' is not defined #28

Closed
malhotrachetan opened this issue May 1, 2017 · 4 comments
Closed

NameError: name 'xrange' is not defined #28

malhotrachetan opened this issue May 1, 2017 · 4 comments

Comments

@malhotrachetan
Copy link

Hey everyone, I was going through the: 'Making plots with matplotlib' part of python docs and in the section: 'First Histogram'
screen shot 2017-05-02 at 3 36 19 am

it throws an error:
screen shot 2017-05-02 at 3 37 59 am

I guess in data = [random.random() for i in xrange(2000)], data should be declared as: data = [random.random() for i in hg.xrange(2000)]

Plus after executing the ditto code from docs, the plot looks something likes this:

screen shot 2017-05-02 at 3 40 42 am
instead of:
screen shot 2017-05-02 at 3 41 09 am

@jpivarski
Copy link
Member

Is this reference to xrange in the tutorial code or in the Histogrammar code? Although we try to make Histogrammar Python 3 compliant, no such attempt was made for the documentation. There are probably also some print statements in there, too.

It would be hard to put the documentation into continuous integration to check for Python-2isms.

@jpivarski
Copy link
Member

Oh, hi Chetan!

@malhotrachetan
Copy link
Author

Hello!
Yeah, this is in reference to documentation code and the code was tested in IPython qtconsole with Python-3

@jpivarski
Copy link
Member

You're free to edit the histogrammar-docs repository (on a separate branch with pull request, following standard practices), if you're interested. In fact, it would be a good exercise to check out and generate documentation with Jekyll because you'll probably be adding more at some point. But it's not a goal to support Python 3 in the documentation text, since the user can see that as they type it. Python 3 users shouldn't type "xrange."

I'm going to close this now, but you can open another one on histogrammar-docs, fix it, and then close it.

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

No branches or pull requests

2 participants