Skip to content

Support Point in pg.Rect.__contains__ #3531

@Hato1

Description

@Hato1

Description

Currently, to detect when a Point intersects with a Rect, collidepoint seems to be the preferred method.

if rect.collidepoint(point):
    ...

It would be more pythonic and improve code readability to additionally add this functionality to Rect's __contains__.

if point in rect:
    ...

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