Consider merging `startswith`/`endswith` checksPY-W0077
The methods startswith
and endswith
for string instances accept two types of Python constructs as the first argument. The types are:
- a Python string, or
- a tuple of strings
It is recommended to merge the arguments of multiple calls to startswith
/endswith
connected by or
.
Bad practice
if s.startswith('a') or s.startswith('b'):
...
Recommended
if s.startswith(('a', 'b')):
...