On Friday 23 July 2010 15:30:28 Maarten ter Huurne wrote:
> On Friday 23 July 2010, Duncan Gibson wrote:
> > > I've seen people writting
> > >
> > > timestamp, name, _, permission = get_next_entry()
> > >
> > > The drawback is that your reader loose the information that you're
> > > expecting fsize as 3rd element. It may be worth it though.
> > > You just have to make sure that '_' is identified  as a dummy
> > > variable in your pylint rules.
> >

> > I've modified my .pylintrc file to have the following:
> >
> > dummy-variables-rgx=(_|dummy|(unused.*))
> >
> > which would allow me to have:
> >
> > timestamp, name, dummy, permission = get_next_entry()
> >
> > or the self-documenting:
> >
> > timestamp, name, unused_fsize, permission = get_next_entry()
>
> I have done something similar:
>
> In pylintrc:
> dummy-variables-rgx=[^_]*_
>
> In the source code:
> timestamp, name, fsize_, permission = get_next_entry()
>
> It really helps code readability to give names to things you untuple,
> even if you don't use all of them.


ok, I guess I should have mentionned what I had to check myself: 

Pylint uses the dummy-variable-rgx with the "match" method, and this 
method "match" *if and only if* the variable name starts with the regex; 

example :

dummy-variables-rgx=_|dummy|unused

will match '_'  ,'_hello', '_fsize', 'dummy_sth', 'unused_var', etc,

but not 'not_used', another_dummy', 'mydummyunusedvar' etc.

Maybe we should explain that in the pylintrc file more explicitly ...

-- 

Emile Anclin <[email protected]>
http://www.logilab.fr/   http://www.logilab.org/ 
Informatique scientifique & et gestion de connaissances
_______________________________________________
Python-Projects mailing list
[email protected]
http://lists.logilab.org/mailman/listinfo/python-projects

Reply via email to