Skip to content

Remove undocumented rect1 in rect2 functionality in Rect.__contains__ #3980

Description

@aatle

There is a currently undocumented functionality of Rect.__contains__ where one can check if another rect is completely contained inside the rect, the same functionality provided by the original Rect.contains() method.
Added by pygame/pygame#2897.

I saw this from #3531 (comment).

The __contains__ magic method is mainly intended for checking if an item is an element of a collection. Overloading it with other functionality for syntactic sugar is not necessary and a bit confusing.

So, I think this functionality should be removed from __contains__.

This affects #3877, which adds a small docstring to __contains__ referencing this behavior (though it does not appear in the generated API reference).

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions