Skip to content

Implement PartialEq for more Bound<'py, T> types #4250

Closed
@davidhewitt

Description

@davidhewitt

After #4245 we have equality between Python str and Rust str, which I think is a nice user-facing feature.

There's a possibility to go further here and implement this for more types:

  • PartialEq<[u8]> for Bound<'py, PyBytes> seems to fit the same category of behaviour
  • PartialEq<i32> for Bound<'py, PyLong>, maybe? (And other int types)
  • similar for floats?
  • PartialEq<bool> for Bound<'py, PyBool>?

I think there's a reasonable case to be made that all of these can be implemented without risk of exception.

The main concern I have with these implementations is what to do with Python subclasses - as per #4245 (comment)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions