On Wednesday, April 26, 2017 at 10:08:08 AM UTC-5, Edward K. Ream wrote:
One final note. The code passes with 'consider-iterating-dictionary' and
'consider-using-enumerate' checkers enabled. The former suggests replacing:
for key in d.keys():
with:
for key in d:
Most such changes happened long ago. The few remaining instances were
straightforward.
The 'consider-using-enumerate' checker suggests changing:
for i in range(len(x)):
s = x[i]
with:
for i, s in enumerate(x):
This checker is impressive because the suggested change works only if i
doesn't change in the loop.
I plan to leave all the presently enabled checkers as they are. Imo, it's
useful to enforce the new standards.
Otoh, I am unlikely ever to enable the 'no-else-return' checker. Imo,
enforcing this would be an anti-pattern. The checker complains about the
following completely natural pattern:
if a:
return b
elif c:
return c
etc.
Yes, it could be replaced by:
if a:
return b
if c: # was elif
return c
etc.
But this is silly. The if/elif/elif/else pattern is basic to programming.
There is no reason to complain about it, even if an "if" or "elif" clause
ends in a return.
Enough about pylint already. Time to move on.
Edward
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.