-
Notifications
You must be signed in to change notification settings - Fork 667
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
numberOfAtoms to n_atoms and others #376
Comments
Just for example. this is the code from import mdtraj as md
traj = md.load(filename, topname) and this is from import pytraj as pt
traj = pt.iterload(filename, topname) there is nothing wrong with having similar API. The main point is to make users feel comfortable with the interface. There is seamless conversion from traj = pt.Trajectory(xyz=m_traj.xyz, top=topology_name) |
With ag.numberOfAtoms() == len(ag)
ag.numberOfResidues() == len(ag.residues) |
On 4 Aug, 2015, at 01:09, Richard Gowers wrote:
There's, however, something to be said for easy introspection. If I do
and get
I know immediately what it does. I would definitely want to have I favor deprecating (Note that I don't think "fast to type" is the biggest argument here --- clarity is more important for complicated and central data structures such as |
On 3 Aug, 2015, at 21:00, Hai Nguyen wrote:
Although this is a separate issue, we could add a compatibility module along the lines of
masquerade.load() would need to do some careful argument juggling to always get the topology (something like args[-1]) and do some sanity checks but at least this way we would have a non-intrusive way of accommodating alternative interfaces. However, such a feature would very much depend on user demand and, well, user contributions, i.e. pull requests by the like of @hainm :-). (At the moment, the core devs have a lot to do with the most pressing other issues.) |
Just saw that |
I'm in favor of |
and they are (n_atoms, n_...) are shorters to write code (we're not always use ipython with |
I'm not so concerned with shorter (the difference is a single character), but readability matters. Any counterpoints to using |
cough |
@richardjgowers
@dotsdl |
@richardjgowers I agree with @orbeckst that we should keep methods for these things for introspection, since they would essentially be minimal effort to maintain. Although I am likewise tempted to say burn them all and just use |
For beginners having methods like 'n_atoms' is nicer. But why not support both? Personally I would prefer 'numatoms' because the underscore is hard to reach. |
Ok, final verdict:
(and no getting rid of them in favor of |
It will be done. On it. |
@dotsdl , please add entry to CHANGELOG for n_atoms and friends – API breakage changes must be documented in the CHANGELOG. |
guys,
as @orbeckst suggested from this issue #372, I am opening this issue to raise discussiong whether mdanalysis should change its behavior, like changing
numberOfAtoms
method ton_atoms
property?My point is quite simple: if your method is not expensive to evaluate, change it to attribute, which is much shorter (numberOfAtoms vs n_atoms). And The method's name should be shortened (as shown). The point is, we (including mdanalaysis) should follow some common
patterns
in Python's world to makeusers
have smooth transition from one to another package. There is nothing wrong if "our" package is similar to others, a package still have some features that others don't have (for example,mdanalysis
is quite good at membrane analysis (vspytraj
)).PS: I myself wrote my own package (
pytraj
), so I am not benefit from the changing (:D) butmdanalysis
.My suggestion is too look at attributes from
mdtraj
package. It has pretty good naming stuff (one ofpytraj
's developers always suggesting usingmdtraj
in 1st place, so I think there must be a reason).The text was updated successfully, but these errors were encountered: