[Python-projects] pylint: W0706
Sylvain Thénault
sylvain.thenault at logilab.fr
Wed Jul 30 14:50:00 CEST 2008
On Wed, Jul 30, 2008 at 02:27:15PM +0200, Maarten ter Huurne wrote:
>
> Hi,
Hey Maarten,
> When I run pylint on the following code:
> ===
> class MultiException(Exception):
>
> def __init__(self):
> Exception.__init__(self)
> self.messages = []
>
> def add_error(self, message):
> self.messages.append(message)
> return self
>
> raise MultiException().add_error('blah')
> ===
> I get the following output:
> ===
> W0706: 11: Identifier MultiException().add_error('blah') used to raise an
> exception is assigned to class MultiException(Exception):
> def __init__(self):
> Exception.__init__(self)
> self.messages = []
> def add_error(self, message):
> self.messages.append(message)
> return self
> line 1
> ===
>
> I don't understand what this warning is warning me about.
huum, I think pylint is trying to check that the exception you're
raising is something that can actually be raised, but in that case an
inference pb caused the false positive.
> Also, I think it's very strange that the class body is included in the
> warning.
indeed. I'll add a ticket for those two problems.
Thanks you for reporting this.
--
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