Skip to content

Use 'import numpy as np' convention? #2391

Closed

Description

@peterjc

The convention in the NumPy documentation is to use import numpy as np and then for examplenp.array(...) in code.

Currently Biopython for the most part uses import numpy and numpy.array(...) with only some newer code using the shorthand.

I am proposing we switch all our NumPy usage and examples to use the import numpy as np style, which should be familiar to most Biopython users dealing with NumPy.

If people agree, this would be a good first-issue for newcomers to work on (e.g. taking each different top level module one at a time).

Activity

  1. mdehoon commented on Dec 9, 2019

    @mdehoon
    Contributor

    I vote against. It is unnecessary work, it adds to the style rules we have to follow, and numpy is explicit and therefore less confusing, especially for newcomers.

  2. peterjc commented on Dec 9, 2019

    @peterjc
    MemberAuthor

    So would you rather we switch the handful of import numpy as np to the more explicit import numpy style? Or just leave things as they are with a mixture?

  3. MarkusPiotrowski commented on Dec 9, 2019

    @MarkusPiotrowski
    Contributor

    I would be in favor of using import numpy as np but if we can't agree on that, I would leave things (mixed) as they are.

  4. mdehoon commented on Dec 9, 2019

    @mdehoon
    Contributor

    @peterjc Leave things as they are. There are bigger things to worry about in Biopython. Currently we have 311 open issues and 83 pull requests in progress; let's handle those first.

  5. jyscao commented on Dec 10, 2019

    @jyscao

    I can definitely work on this if you guys do decide to go with the standard numpy import convention, which IMO is a good idea. Since at this matured point and time in the Python community, np really does not, would not and should not refer to anything else other than numpy.

    Also as I'm not a current contributor to Biopython (though I'd definitely like to, and this would be a good opportunity for me to get some basic familiarity with the code base), my working on this does not dilute the project's contributor resources, at least in theory, so long as I do not introduce regressions or breaks, which shouldn't be the case given the nature of this change, though I'd of course be thorough with the testing nonetheless.

  6. peterjc commented on Dec 13, 2019

    @peterjc
    MemberAuthor

    Thanks @jyscao - hopefully there are other newcomer friendly issues you might want to tackle?

    Let's close this for now - and perhaps revisit it next year?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions