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

Support iterable in display.update #2987

Merged
merged 1 commit into from
Jul 21, 2024
Merged

Support iterable in display.update #2987

merged 1 commit into from
Jul 21, 2024

Conversation

ankith26
Copy link
Member

fixes #2986 by adding Iterable support in display.update

Before someone points it out, yes it could potentially slightly lower performance, though I have done no benchmarking. There is scope for optimizing this function with our usual tricks though, i.e fastcall and list/tuple "fast sequence" special path, though I will leave that for future PRs.

Also this PR takes the opportunity to improve the tests for this function.

@ankith26 ankith26 requested a review from a team as a code owner July 12, 2024 16:29
@ankith26 ankith26 force-pushed the ankith26-update-iterable branch from ea9057d to 83f6a4b Compare July 12, 2024 16:44
@yunline yunline added enhancement display pygame.display labels Jul 13, 2024
Copy link
Member

@oddbookworm oddbookworm left a comment

Choose a reason for hiding this comment

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

I think this is a good change. Given the rare use I've seen of this, I don't expect too many people to take advantage though lol. Just got a couple small comments

docs/reST/ref/display.rst Show resolved Hide resolved
src_c/display.c Show resolved Hide resolved
@ankith26 ankith26 force-pushed the ankith26-update-iterable branch from 83f6a4b to e453cbd Compare July 14, 2024 06:32
Copy link
Member

@damusss damusss left a comment

Choose a reason for hiding this comment

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

I tested locally, and the new code supports both sequences and iterables while the old one only sequences. I also did some dirty benchmark, and the performance is the same.

LGTM :)

@ankith26 ankith26 force-pushed the ankith26-update-iterable branch from e453cbd to aabeed9 Compare July 21, 2024 18:44
@ankith26
Copy link
Member Author

Rebased to fix a merge conflict

@damusss damusss added this to the 2.5.1 milestone Jul 21, 2024
@damusss damusss merged commit 6d8007c into main Jul 21, 2024
39 checks passed
@ankith26 ankith26 deleted the ankith26-update-iterable branch July 22, 2024 04:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

About Pygame's "Sequence" object and display.update
4 participants