[Python-projects] Statement seems to have no effect

Sylvain Thénault sylvain.thenault at logilab.fr
Sun May 7 12:11:27 CEST 2006


On Thursday 27 April à 22:56, Nicolas Chauvat wrote:
> On Thu, Apr 27, 2006 at 01:26:18PM -0500, Meding, Olaf wrote:
> > > Of course it is since pylint thinks your defining of such a string was unintentional :)
> > 
> > How likely is that someone would do this unintentionally (compared to purposefully commenting out code)?
> 
> A comment is a comment. A string is a string.
> 
> The fact that the above works does not prove it is a good idea. It is
> a side effect of how Python is interpreting code and discarding the
> result of the evaluation in case it is not assigned to a variable. 
> As in
> 
> operator.add(1,1)
> 1+1
> 
> As suggested by Maarten, splitting W0104 in two (and have a W0104bis
> String not used) could be doable, but I am not sure how easy it would
> be to implement.

it's easy, and I've implemented it in the repository, now you'll get a
W0105 for string statements.

-- 
Sylvain Thénault                               LOGILAB, Paris (France)
Formations Python, Zope, Plone, Debian:  http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
Python et calcul scientifique:           http://www.logilab.fr/science



More information about the Python-Projects mailing list