-
Notifications
You must be signed in to change notification settings - Fork 20
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
feat: support _to_boost_ #483
Conversation
Tests are failing because of the new setup-python release: actions/setup-python#171. We can pin to an older one until it's fixed. (Though the new release is really exciting, it now supports all versions of PyPy, in all flavors! Well, it would, anyway, if it worked...) :) |
(actually intended to write this on another PR, but guess it's okay here.) |
353f144
to
9da086e
Compare
I'm bothered by the fact this is a public method. We might come up with a better method design later, so how about we select |
@jpivarski would you be okay if we make this |
Sure, if you do the pull request on Uproot, I'll accept it. You'll have to coordinate versions, but I can make an Uproot release candidate immediately after your PR. |
Hidden methods are better than public methods. The long name bothers me, why not call it simply |
My thought was this will never have to be typed, and someone coming across a method called So, now that you know my reasoning, do you like |
All those arguments are valid, but for consistency/symmetry with |
Okay, though matching |
In following this, I've also been thinking that " Since this is an underscored name, brevity is not important: users will not be typing it. However, it's part of a protocol for developers, so it is important what that name is, and the need for consistency is heightened. (After all, these underscores don't mean "private"—a name like |
Also, |
@HDembinski please confirm one of the two proposed names PS: I finally merged the other PR, #498, since I make the requested change related to the PR, updated the explanation, and the unrelated change of dropping |
I am sorry for letting you down on this and I apprecitate how fast you reacted on the release. I choose |
Co-authored-by: Henry Schreiner <henry.fredrick.schreiner@cern.ch>
Thank you @HDembinski! Sorry I snapped a bit. Not getting much sleep here. 👶 I'm going to get a 0.13 release out so it can sit for a bit while I'm off before the deprecation/Py2 cleanup for 1.0 starting in March! |
Pulled the change out from #475 so that it can get a proper discussion if it needs it.
Boost-histogram already supports casting - you can call
Hist(a_boost_object)
, where Hist is any boost-powered project, including Hist, and it converts. Likewise withHistogram(a_hist_object)
. This allows uproot to participate - you can callbh.Histogram(an_uproot_histogram)
and it converts by first callingto_boost
, then using the standard mechanism to convert it tobh.Histogram
(or Hist, or any other dependent project if more get added).The main question I'd like to discuss is: should we use the current method uproot provides,
.to_boost()
, or instead provide a hidden method to do this, like_to_boost_()
, and add it to uproot? If Physt were to add a method, I bet Jan would be fine withto_boost()
, but not requiring a user-visible method might be better? Also, in the future, we might want to provide a way to produce a structure that boost-histogram can adapt to reduce coupling - but that's very far away - sticking to a hidden method now would keep us from having to expose a public method tied to the old method if a new one was added.Edit: As seen below, I went with
_as_boost_histogram_()
.