-
Notifications
You must be signed in to change notification settings - Fork 66
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
Better function names #77
Comments
I'm open to renamings, but I would want to avoid overlap with pyplot namespace in case we ever switch to monkeyclassing |
You should not try to avoid name clashes. We have namespaces to resolve the ambiguity. That's the reason everyone writes |
Look at cupy, jax, etc, these re-implement the numpy interface with the exact same names and calling conventions under a different namespace, precisely so that you can do
|
But they keep the api close to same right? Whereas here we change what
"hist" is expecting.
What do we then do if we decide to monkeyclass histplot onto pyplot. Or if
we manage to convince mpl to actually have a histogram plotting fcn.
…On Mon, Feb 24, 2020, 09:36 Hans Dembinski ***@***.***> wrote:
Look at cupy, jax, etc, these re-implement the numpy interface with the
exact same names and calling conventions under a different namespace,
precisely so that you can do
# import numpy as np
from jax import numpy as np
# do numpy stuff
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#77?email_source=notifications&email_token=ADE5EBBAVFEGPEFNYZKCWZTREOBKNA5CNFSM4KYS73S2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMW7MUY#issuecomment-590214739>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADE5EBALGEWOEU2O67BPNF3REOBKNANCNFSM4KYS73SQ>
.
|
Ok, you are right, it is not exactly the same situation. If I understand correctly, you are already preparing for a possible merging of mplhep into pyplot. I think this is not going to happen very soon, and even when it is, the names will be debated again anyway. You cannot anticipate how that merging will go. The matplotlib guys could decide to place this in mpl_toolkit, then you would have an extra namespace anyway. For now, we should use names that are easy to type. I like the idea of imitating the pyplot.hist and hist2d interface, so that it is easy to switch over and you do not have to relearn another interface, that is great. However, the following should work mplhep.hist(*np.histogram(data)) |
@HDembinski Would you find it a reasonable solution to alias the two for now? |
Yes, and to deprecate |
This is the deprecation decorator I use in iminuit, feel free to copy this or allow me to make a PR with the change. |
The chosen function names are not ideal.
histplot -> hist
histplot
is not Pythonic snake_case, it should have beenhist_plot
for better readability but actually...plt.hist
, it should have the same namehist2dplot -> hist2 or hist2d
plot
at the end is superfluous, and again it is not proper snake_caseThe text was updated successfully, but these errors were encountered: