C407 increases laziness which should be noted since it can change behaviour
See original GitHub issueThe following issues the C407 warning (as desired)
results = all([m.delete() for m in q.where_in(self._other_key, ids).get()])
however if you appease it and switch the code to
results = all((m.delete() for m in q.where_in(self._other_key, ids).get()))
or
results = all(m.delete() for m in q.where_in(self._other_key, ids).get())
It causes a subtle bug due to the new laziness gained by the generator expression
This can be evidenced here
>>> all((print(i) for i in range(1, 10)))
1
False
>>> all((print(i) or True for i in range(1, 10)))
1
2
3
4
5
6
7
8
9
True
This warning should probably remind/warn (haha) the user that there is a risk in changing it to follow the warning if the generate has a side effecting function in it
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Grit (effortful persistence) can be measured with a short scale ...
Study 2 investigated how grit relates to career success (income, job prestige, job satisfaction) and career engagement (working overtime, participation in ...
Read more >The Character of the Athenian Empire - JSTOR
garded as a supplement to his "Athenian Democracy and its Critics," in Camb. ... change to tributary status - in effect, their laziness...
Read more >Exploring World Geography Guide for Parents and Answer Key
This course is a survey of the physical geography of the world and human geography—how humans throughout history have interacted with geography. The...
Read more >gdb-8.2/gdb/po/gdb.pot - toolchain/gdb.git - Git at Google
msgid "Cannot switch to task %d: Task is no longer running". msgstr "" ... "Note: automatically using hardware breakpoints for read-only addresses.\n".
Read more >The Application of Mindfulness of the Sacred Dharma / The ...
Minor killing is to kill an animal or someone of degenerate moral conduct. ... The petals are as radiant as the sun when...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yah, its tough. It seems like a decent rule, but it can bite you pretty hard. Maybe if it defaults to being ignored, and has a more strongly worded warning about its implications? That could be a good compromise.
in the haskell linter, hlint, there are a few lints that warn you that they either increase or decrease laziness.
Rule C407 has been a constant source of problems - 5 or 6 bugs in the changelog: https://github.com/adamchainz/flake8-comprehensions/blob/master/HISTORY.rst . I’m tempted to just remove it. I’d prefer this library gave 100% actionable advice rather than “sometimes this is a good idea” tweaks. What do you think?