[Python-projects] nice-to-have: analyze (some) strings for variable use
Sylvain Thénault
sylvain.thenault at logilab.fr
Tue Jul 28 14:44:39 CEST 2009
On 08 juillet 05:58, skip at pobox.com wrote:
> In this function pylint complains that a and b are unused:
>
> def f(a):
> b = "some var"
> return "%(a)s, %(b)s" % locals()
>
> It would be nice if it noticed literal % locals() structure and treated
> variable references within the string as actual usage.
http://www.logilab.org/ticket/9839
In a more general way, pylint should have better understanding of interpolated
string (at least issue error on cases such as ::
'%s' % (a, b)
'%(key)s' % {'ke' : 'value'}
...
Would someone be aware of something to extract "interpolation data" from a string?
I've to admit I've not took the time to search for such thing...
--
Sylvain Thénault LOGILAB, Paris (France)
Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
Développement logiciel sur mesure: http://www.logilab.fr/services
CubicWeb, the semantic web framework: http://www.cubicweb.org
More information about the Python-Projects
mailing list