On 04 février 15:33, Alexandre Fayolle wrote: > On Thursday 04 February 2010 15:13:14 Diez B. Roggisch wrote: > > On Thursday 04 February 2010 14:15:33 Sam Tygier wrote: > > > i wonder if pylint could be made to spot the following error > > > > > > if ans.lower in ["yes", "y"]: > > > > > > where the function is compared, rather than calling the function and > > > comparing the result. > > > > > > maybe it could check for any comparison between a function and a > > > literal. > > > > It can't possibly know that lower is a function instead of a simple string. > > > > class Foo(object): > > > > lower = "yes" > > > > ans = Foo() > > > > if ans.lower in ["yes", "y"]: > > print "yieha" > > > > In that case, no, but in the following code, pylint can know that ans.lower > is > a method.
type inference should help in the case above as well. Could one of you add a ticket? -- 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 _______________________________________________ Python-Projects mailing list Python-Projects@lists.logilab.org http://lists.logilab.org/mailman/listinfo/python-projects