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

Replace .next() with next() for py3 compatibility #2

Merged
merged 1 commit into from
Apr 8, 2017

Conversation

MattKleinsmith
Copy link
Contributor

In Python3:

AttributeError                            Traceback (most recent call last)
<ipython-input-16-dc3a6e32cc0b> in <module>()
      1 
----> 2 w = model.parameters().next().data # model has only one parameter

AttributeError: 'generator' object has no attribute 'next'

next() works in python 2 and python 3.
.next() only works in python 2.

@vinhkhuc
Copy link
Owner

vinhkhuc commented Apr 8, 2017

Thanks, Matthew!

@vinhkhuc vinhkhuc merged commit d612f81 into vinhkhuc:master Apr 8, 2017
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