-
Notifications
You must be signed in to change notification settings - Fork 3
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
Fix Python list arguments #308
Conversation
I actually mentioned the opposite: https://github.com/NNPDF/pineappl/pull/302/files#r1709362111. Both are different with |
Mmm seems I misremembered ... so maybe we want to discuss the PS: and the unit tests do, what a user would do, no? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace <>.map_or(vec![], ...)
with <>.unwrap_or(vec![])
. That saves the second argument which is unnecessary now; it converts a Vec
into the same Vec
, which is essentially clone.
The more general question is: Shouldn't we replace all instances PyReadonlyArray1
with Vec
?
done in 5117ea1 (note that I applied the same logic to
not sure - @Radonirinaunimi since you have already though about it: can you please give an advice? 😇 |
Since we're going to make a 'major' release, I think we can make (more) breaking changes. What do you think, @Radonirinaunimi? |
@felixhekhorn sorry, but there's an even better variant: |
done in 9a163bb |
Apologies for having forgotten about this (got dumped into a mountain of things)! After some thinking, yes, I do think that there is more benefit in having the input types to be uniform and general as much as possible. Especially since I don't think this would be much of a breaking change. Actually, as mentioned here, So, we should go for this change, and at the same propagate it into the other functions. Extra-note: Actually, I think that if we change the return type of the following function into pineappl/pineappl_py/src/boc.rs Lines 129 to 144 in 7053cec
|
@cschwan this PR is not touching the CAPI in any way, but still it is failing - do you know why? Else this is ready to be merged |
This should be the new container which installs the CAPI in a different directory. I'll merge into |
I could not find back the comment of @cschwan where he was asking about why we're using sometimes
Vec
and sometimePyReadonlyArray
and @Radonirinaunimi replied, that should not make a difference. The unit tests here prove it does make a difference (i.e. they will not pass without the changes in the interface) and the correct thing is to useVec
.Else you get
and likewise wrapping in
np.array
does not workhowever, this must have changed recently (e.g. in #302) because in v0.7.4 where I was hit by the problem I could still do
also note that in v0.7.4 the error is slightly different:
do we want to keep fixing former version, or not? (else I can work around that - I was too lazy so far to upgrade to v0.8 as it is a major change and I know v0.9 will be as well)