[TIP] Teaching pylint about keyword placeholders in string formatting

Nicolas Chauvat nicolas.chauvat at logilab.fr
Wed Jul 15 12:39:48 CEST 2009


On Wed, Jul 15, 2009 at 08:08:13PM +1000, Ben Finney wrote:
>     def frobnicate(warble):
>         foo = complex_computation()
>         bar = long.access.path.leading.to.useful.value
>         baz = (lengthy + expression * with_several_parts)
>         spangulate("%(warble)s: %(foo)s%(bar)s [%(baz)d]" % vars())
> This allows the format of the string to be clear, and allows the
> separate parts of it to have meaningful names.
> However, this is causing pylint to complain::
> ...
> That is, pylint is not aware that the names used by accessing the values
> from the dictionary returned by ‘vars()’.
> ...

You are not the only one:

Here is the ticket:

Thanks for the report. As usual, help and patches are welcome.

Nicolas Chauvat

logilab.fr - services en informatique scientifique et gestion de connaissances  

More information about the Python-list mailing list