Skip to content

Comparison between points #2

@hroncok

Description

@hroncok

Currently, it is not possible to compare two points.

a = Point(0, 0)
b = Point(0, 0)
a == b
> False

It would be useful to have this functionality.

def __richcmp__(Point self, Point other, int operation):
    if operation == 2:
        return self.x == other.x and self.y == other.y
    elif operation ==3:
        return self.x != other.x or self.y != other.y
    else:
        ...

More info at: http://docs.cython.org/src/userguide/special_methods.html#rich-comparisons

I can write it, after my previous PR is merged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions