We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
impl_eq!
__richcmp__
For types that implement PartialEq/Eq, Python's __richcmp__ dunder method is easily defined as:
PartialEq
Eq
#[pymethods] impl PyType { pub fn __richcmp__(&self, py: Python<'_>, other: &Self, op: CompareOp) -> PyObject { match op { CompareOp::Eq => (self.as_inner() == other.as_inner()).into_py(py), _ => py.NotImplemented(), } } }
An impl_eq! macro would be a nice addition to handle this case. The overlap with impl_compare! would have to be well documented to avoid confusion.
impl_compare!
The text was updated successfully, but these errors were encountered:
No branches or pull requests
For types that implement
PartialEq
/Eq
, Python's__richcmp__
dunder method is easily defined as:An
impl_eq!
macro would be a nice addition to handle this case. The overlap withimpl_compare!
would have to be well documented to avoid confusion.The text was updated successfully, but these errors were encountered: