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

is_eq, is_gt, etc helper methods #2155

Closed
aldanor opened this issue Feb 8, 2022 · 2 comments · Fixed by #2175
Closed

is_eq, is_gt, etc helper methods #2155

aldanor opened this issue Feb 8, 2022 · 2 comments · Fixed by #2175

Comments

@aldanor
Copy link
Contributor

aldanor commented Feb 8, 2022

Just a thought: why don't we add is_eq(), is_gt() etc methods (alongside the compare and rich_compare), for the sake of newcomer-friendliness? Sort of the same as is_none() etc.

Also, note explicitly in trait impl docstrings (and in is_eq/is_ne docstrings) that PartialEq compares pointers, which may otherwise lead to confusion.

(Here's a use case example. I've used pyo3 and rust-numpy for quite a lot and I've read large chunks of its sources but never needed to compare Python objects before for some reason. When I did, I started searching docs.rs and source code and gh repo for "eq" but was unable to find anything. It took me a good while till I randomly stumbled on rich_compare. Maybe I'm still missing something?)

@davidhewitt
Copy link
Member

I think having is_eq() etc. is a great idea! PRs very welcome.

@mejrs
Copy link
Member

mejrs commented Feb 8, 2022

I started searching docs.rs and source code and gh repo for "eq" but was unable to find anything.

At the very least we can make some doc aliases for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants