Skip to content
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

Deprecate the wrappers of the array iterator API. #280

Merged
merged 3 commits into from
Mar 3, 2022

Conversation

adamreichold
Copy link
Member

@adamreichold adamreichold commented Feb 25, 2022

Follow-up to #279, deprecating the npyiter module with a short explanation of why ndarray's facilities are preferable.

@adamreichold
Copy link
Member Author

I also noticed that the implementations of Iterator::size_hint were incorrect (they did not consider the amount of iteration already performed) and added a commit fixing this. If we decide against the deprecation after all, this should probably be cherry-picked elsewhere.

@davidhewitt
Copy link
Member

With apologies just saying that I've seen this and the other PRs but haven't had enough time to dedicate a read of these and form any opinion. Might be able to do so tomorrow evening, depending on how long you want to delay the 0.16 numpy release.

@adamreichold
Copy link
Member Author

With apologies just saying that I've seen this and the other PRs but haven't had enough time to dedicate a read of these and form any opinion. Might be able to do so tomorrow evening, depending on how long you want to delay the 0.16 numpy release.

Please take your time. I think delaying the release until you or @kngwyu had time to look into the two PR related to the npyiter module (#279 and #280 here) is fine.

I think I should merge the already prepared #259 after you make the 0.16 release of PyO3, so people can upgrade using a Git dependency against our main branch here. After that we can take our time making a decision on the npyiter issue.

Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I think the rationale here makes a lot of sense, let's proceed with this.

One thing I'm unsure on, does using ndarray iteration require unsafe? (At least until #274 or similar.) It might be nice to have an example to point users at so that they know what to replace the deprecated code with.

@adamreichold
Copy link
Member Author

adamreichold commented Mar 3, 2022

One thing I'm unsure on, does using ndarray iteration require unsafe?

Only under the same circumstances that the npyiter module requires it, so it is does not when using PyReadonlyArray. Once an ArrayView is at hand, there is no additional need for unsafe. I will extend the module-level comment to point users at the PyReadonlyArray type and its as_array method.

@adamreichold adamreichold merged commit 2587fd9 into main Mar 3, 2022
@adamreichold adamreichold deleted the deprecate-npyiter branch March 3, 2022 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants