[PATCH] keyword: reduce pylint warnings by renaming some variables

Christian Ebert blacktrash at gmx.net
Wed Feb 10 02:33:40 CST 2010


* Matt Mackall on Tuesday, February 09, 2010 at 20:13:45 -0600
> On Tue, 2010-02-09 at 14:53 +0100, Christian Ebert wrote:
>> * Dirkjan Ochtman on Tuesday, February 09, 2010 at 14:19:15 +0100
>>> On Tue, Feb 9, 2010 at 14:16, Benoit Boissinot
>>> <benoit.boissinot at ens-lyon.org> wrote:
>>>> W0621:166:kwtemplater.overwrite: Redefining name 'files' from outer scope (line 375)
>>>> W0621:166:kwtemplater.overwrite: Redefining name 'expand' from outer scope (line 365)
>>> 
>>> Okay, in that case it makes some amount of sense.
>>> 
>>> I do recognize that pylint has value in that it helps reducing some
>>> classes of bugs, but sometimes it complains about perfectly valid
>>> code.
>> 
>> I know. I wasn't acting in complete blind obedience to pylint
>> though, but please feel free to treat the patch as a practical
>> inquiry (on how pylintish one should get) only, albeit overdone.
> 
> If you think this patch is an actual improvement in the clarity of this
> code, then we can do it. But I think a better approach would have been
> to change the name of the top-level files and expand functions. They
> could be made to match their corresponding command names, for instance.

Oh. That was my impulse for a long time actually (pylint or not),
but from staring at mq.py as good example I had the impression
that it's bad practice to do that. Obviously there are
limitations to learning by imitation ;-)

For kwfiles however, this reintroduces 1 pylint warning because I
have both "files" and "kwfiles" as variable names in the top
level (kw)files function.

As for clarity my personal preference would then be for all top
level functions to match their command names.

I'll think about it. Thanks.
 
c
-- 
So macht Bewußtsein Sitzfleisch aus uns allen.
--Heiner Müller, Wolokolamsker Chaussee IV


More information about the Mercurial-devel mailing list