Visitar URL original
methods: Drop support for iterators where they are not needed by devops117 · Pull Request #969 · pyrogram/pyrogram · GitHub
The Wayback Machine - https://web.archive.org/web/20240120105446/https://github.com/pyrogram/pyrogram/pull/969
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

methods: Drop support for iterators where they are not needed #969

Merged
merged 9 commits into from May 14, 2022
Merged

methods: Drop support for iterators where they are not needed #969

merged 9 commits into from May 14, 2022

Conversation

devops117
Copy link
Contributor

It's untested code
Appropriate description should be there in commit messages

Since we used a list there anyway, this approach will lead to more localized errors and can reduce function overhead.

Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com>
An example usecase would be for a normal bot which uses range based on message ids
instead of keeping a track of messages and using the DeletedMessagesHandler.

Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com>
@delivrance
Copy link
Member

There are multiple places where iterators are accepted (range in practice) in place of a list of ints, maybe we should drop support there as well for the sake of keeping the methods simpler too.

@devops117
Copy link
Contributor Author

Thanks for mentioning that, so I'll rename the PR and look for them, should I revert the pts_count commit?

@delivrance
Copy link
Member

Returning the affected messages is fine. The other methods left are forward_messages, get_messages and get_users.

@devops117 devops117 changed the title delete_messages: drop support for generators and return pts_count:int methods: Drop support for iterators where they are not needed Apr 25, 2022
Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com>
@devops117
Copy link
Contributor Author

Looking forward to a code review or a possible merge.

@delivrance delivrance merged commit 6e1425a into pyrogram:master May 14, 2022
@delivrance
Copy link
Member

I've applied some minor changes and merged. Thanks.

@delivrance
Copy link
Member

After some feedback I decided to revert some of the changes applied here in order to favor back usage convenience instead of implementation simplicity. Iterators are now allowed again as they make usages simpler and less cluttered.

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

Successfully merging this pull request may close these issues.

None yet

2 participants