-
Notifications
You must be signed in to change notification settings - Fork 112
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
Add new untyped PyAnyArray base type of PyArray. #369
Conversation
a9f35ce
to
2b07351
Compare
Neat! Sorry for the slight delay, my family and I have been sick... again... 🙃 The |
The main issue here is that auto-deref chaining does not apply, right? |
2b07351
to
c4adf9a
Compare
Yes exactly, I wondered whether we could express the chain with a separate trait somehow to work around that. |
Something like trait PyAsAny {
fn as_any(&self) -> &PyAny;
}
impl<R,S,T> PyAsAny for R where R: Deref<Target=S>, S: Deref<Target=T>, T: Deref<Target=PyAny> {
fn as_any(&self) -> &PyAny {
self.deref().deref().deref()
}
} etc., probably generated via a declarative macro? |
Since you mentioned this, I am somewhat concerned about downstream code which would have to migrate from |
c4adf9a
to
de31c04
Compare
Yes, that concern of downstream breakage is what I was unclear on too. With |
Putting my take-one-for-the-team hat on, maybe we should use rust-numpy as a test balloon and do this here to "only" break crates using rust-numpy, but not all of the PyO3 ecosystem. If we actually break anything that is. The code in rust-numpy itself was completely unaffected because auto-deref chaining was apparently sufficient. I think the pattern fits well often enough as you describe above and we have to take a step a some time so it might be this one where the breakage would be limited. (Concerning the PyO3-specific crater thing: I don't think it would be completely unreasonable to set this up. It could basically be a set of Python scripts booting into a single throw-away VM (we don't need to isolate the builds from each other AFAIU, just my user account from the builds) and then building the relevant crates with a patch section pointing to a given ref in the PyO3 repository. The main issue I see ATM, is that crates.io lists less than 300 reverse dependencies for PyO3 and most of them use older versions. Which makes sense as Python extensions are not distributed via crates.io. So I guess we would need to crawl PyPI for packages using PyO3?) |
I'm a bit worried that this name looks somewhat similar to the array of |
I am personally very much not married to the name and would be very open to suggestions for alternatives. |
I've thought of a few ideas ( |
I am somewhat endeared with |
|
Seems reasonable to give this a shot for sure! |
If two people can agree on it, it is golden and I will change the PR to use I don't import flavours are helpful here: There are easy to misread (same problem as |
I changed the name to Or are there any other concerns besides the name and the deref problem w.r.t. the current implementation? |
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.
Some nitpicking comments on CHANGELOG and documents. Implementations look pretty reasonable for me.
… which can be useful to guide type inference.
No description provided.