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

Adding support for Python 3. #9

Merged
merged 2 commits into from
Apr 4, 2014
Merged

Adding support for Python 3. #9

merged 2 commits into from
Apr 4, 2014

Conversation

sscherfke
Copy link
Collaborator

PYPOWER should now work on Python 2 and 3 with the same codebase. I tested it
with 2.7 and 3., but 2.6 and 3.3 should also work. I don’t think support for older
Python versions is still necessary.

I couldn’t run all tests, because that also wasn’t possible with v4.0.1, but
all tests that passed with 4.0.1 are still passing. I also performed some
power flow computations and they also worked fine.

I didn’t apply all changes 2to3 suggested. The remaining ones are in
https://gist.github.com/sscherfke/9970540 (just in case ...).

These are the most frequent changes I had to apply:

  • print 'spam' --> print('spam') (print is a function, exec, too)
  • raise Exception, 'value' --> raise Exception('value') (new Syntax for exceptions)
  • from mod import fcn --> from pypower.mod import fcn (absolute/relative imports)
  • There is no more basestring in Py3. Set basestring = str here.

PYPOWER should now work on Python 2 and 3 with the same codebase. I tested it
with 2.7 and 3.3, but 2.6 should also work. I don’t think support for older
Python versions is still necessary.

I couldn’t run all tests, because that also wasn’t possible with v4.0.1, but
all tests that passed with 4.0.1 are still passing. I also performed some
power flow computations and they also worked fine.

I didn’t apply all changes 2to3 suggested. The remaining ones are in
https://gist.github.com/sscherfke/9462075 (just in case ...).
rwl added a commit that referenced this pull request Apr 4, 2014
Adding support for Python 3.
@rwl rwl merged commit 30341a9 into rwl:master Apr 4, 2014
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