Closed
Bug 1811019
Opened 3 years ago
Closed 3 years ago
use `all` and `any` Python builtins instead of checking for `None in list` etc
Categories
(Conduit :: moz-phab, task)
Conduit
moz-phab
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: sheehan, Assigned: sheehan)
Details
Attachments
(6 files)
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review |
moz-phab has a few usages of un-Pythonic idioms to check for invalid values. For example in this if statement we create a list of all the type keys and then re-iterate over the list to see if "abandon" in list is True. We should be using any with a generator, which is more efficient and easier to understand.
| Assignee | ||
Comment 1•3 years ago
|
||
Use any function with a passed generator instead of
building a list and then looking for the value in the
list.
| Assignee | ||
Comment 2•3 years ago
|
||
Depends on D167176
| Assignee | ||
Comment 3•3 years ago
|
||
Depends on D167177
| Assignee | ||
Comment 4•3 years ago
|
||
Sets are faster for __contains__ operations.
Depends on D167178
| Assignee | ||
Comment 5•3 years ago
|
||
Both branches do the same thing, so reduce to the more
generic option to simplify.
Depends on D167179
| Assignee | ||
Comment 6•3 years ago
|
||
Depends on D167180
| Assignee | ||
Updated•3 years ago
|
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•