On Tuesday, April 25, 2017 at 7:43:47 PM UTC-5, Edward K. Ream wrote:
> I've just exterminated many ancient c-isms that test the length of
strings or arrays rather than test s.
Earlier today I made many other changes suggested by pylint, both in Leo's
core and in all plugins. As stated earlier, such changes are inherently
dangerous. However, I believe the risk is worth taking. Little
improvements to style do matter. Furthermore, it's worth considerable work
to keep current with pylint, one of Leo's most important quality tools.
Many of the changes involved the 'consider-using-ternary' checker, which
suggests changing:
x = a and a.b or default
return a and a.b or default
to:
x = a.b if a else default
return a.b if a else default
*Important*: the suggested changes are *not* strictly equivalent. Can you
see why?
In some cases I chose to disable the 'consider-using-ternary' checker
inline and use the old code. In other cases, using getattr with three
arguments is an even better (and clearer) solution.
*Summary*
Recent work has changed Leo's core and plugins in many places. All tests
pass, but *new* bugs could have crept in. The new code should be relatively
safe, but only time will tell.
There is an inherent tension between stylistic improvements and the
potential for disaster. This is the kind of work that should be done early
in a release cycle. The next release won't happen any time soon, so there
should be ample time to catch any goofs.
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.