Skip to content

In python 3 map is a generator, list() it! #456

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

Merged
merged 1 commit into from
May 10, 2016

Conversation

theengineear
Copy link
Contributor

In python 2, you typically get list objects. For efficiency (AFAIK) in
python 3 you’ll get a generator. Note that you can’t iterate through
a generator more than once though!

In python 2, you typically get `list` objects. For efficiency (AFAIK) in
python 3 you’ll get a generator. Note that you can’t iterate through
a generator more than once though!
@theengineear
Copy link
Contributor Author

theengineear commented May 10, 2016

@Kully you had a spent generator. This is a tricky issue between Python 2 and Python 3--good we have tests ;)

The problem is that when a generator is iterated over to completion, you typically can't iterate over it again. Many of the functions in Python 2 return lists whereas these same functions return generators in Python 3.

Hope this helps! Feel free to merge it in if you'd like. It's setup to be merged into your branch. It will just add one commit to your PR.

@Kully Kully merged commit 4237742 into Trisurf_Plots May 10, 2016
@theengineear
Copy link
Contributor Author

@Kully, as a heads up, please delete branches you've merged after your finished with them (i.e., after you've merged them). Otherwise they'll stick around in https://github.com/plotly/plotly.py/branches forever 😸

image

@Kully Kully deleted the fix-empty-generator-in-py3-trisurf branch May 10, 2016 21:05
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