Skip to content
New issue

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

Fix pygame.sprite.Group.has() behavior for no sprites given #2998

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

aatle
Copy link
Contributor

@aatle aatle commented Jul 16, 2024

Make Group.has() return True instead of False when no sprites (empty list, no arguments, etc.) are given.

Closes #2993

This is potentially a breaking change. Might not get approved. See issue for discussion.

@aatle aatle requested a review from a team as a code owner July 16, 2024 01:23
@oddbookworm oddbookworm added the sprite pygame.sprite label Jul 16, 2024
@oddbookworm
Copy link
Member

Can you motivate this change with an example of when this change would actually matter? Offhand, I can't come up with a valid use-case where it should matter what this returns if no sprites are passed

@aatle
Copy link
Contributor Author

aatle commented Jul 16, 2024

Sure.
I'll post it in the issue.

@ankith26
Copy link
Member

I agree that this change is logical, but also, as pointed out before, it could be a backwards incompatible change that could break someones usage.

Copy link
Member

@MyreMylar MyreMylar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree this makes sense, but I think this should wait for compatibility breaking release before being merged as the current behaviour has probably been around since the sprite group was created.

@ankith26 ankith26 marked this pull request as draft August 14, 2024 19:51
@ankith26
Copy link
Member

Thanks for the PR!

Essentially this PR has my approval as well, I'm just drafting it for now because it cannot be merged right now for reasons Myre stated.

@bilhox bilhox added this to the 3.0.0 milestone Oct 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pygame.sprite.Group.has() method behavior for no sprites given
5 participants