Skip to content

don't rewrite list comp to generator expression in short-circuiting f… #451

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

Merged
merged 1 commit into from
May 24, 2021

Conversation

graingert
Copy link
Contributor

@graingert graingert commented May 24, 2021

…unctions

consider the side-effecting function _upgrade

if not all([_upgrade(x) for x in items]):
    raise ValidationError("one or more items failed to upgrade")

the functions all and any don't always consume their input fully and so will skip the side-effect for those items

@MarcoGorelli
Copy link
Contributor

nice, thanks for catching this, I hadn't considered that!

Copy link
Owner

@asottile asottile left a comment

Choose a reason for hiding this comment

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

@asottile asottile merged commit 6d90dd1 into asottile:master May 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants