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

Future: simplify the code for Python3 support only #221

Open
DanHickstein opened this issue Aug 10, 2018 · 0 comments
Open

Future: simplify the code for Python3 support only #221

DanHickstein opened this issue Aug 10, 2018 · 0 comments

Comments

@DanHickstein
Copy link
Member

DanHickstein commented Aug 10, 2018

As @stggh pointed out in #219 (comment), support for Python2 is ending in 2020. As much as I hate to see it go, it seems that it's death is certain, and many projects have pledged to stop supporting it within the next year: http://python3statement.org/

I'm not sure exactly when this change will come to PyAbel (v0.9, circa 2019?), but when it does, it should provide an opportunity to simplify our code, since I recall at least a few occasions where we went a bit out of our way to provide Python2 support.

Here is the list of changes that we should make when we drop Py2 support:

  • We can load .txt.bz2 files directly using np.loadtxt in the examples, basically undoing what was done in Incrementing version to 0.8.0 and including py2 bz2 support #219.

  • We can do away with import six

  • We can get rid of the from __future__ imports that are on top of most of the .py files:

    from __future__ import absolute_import
    from __future__ import division
    from __future__ import print_function
    from __future__ import unicode_literals
  • In example_simple_GUI.py and example_GUI.py, we can simplify the lines like:

    from six.moves import tkinter_ttk as ttk
    from six.moves import tkinter_scrolledtext as scrolledtext

    to

    import tkinter.ttk as ttk
    import tkinter.scrolledtext as scrolledtext

I'll amend this list as we come across more examples of simplifications that we can make when we go Py3-only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant