] > Re: [pylint] New Bug submitted (W0212 - faux positifs) (Logilab.org)

Email Re: [pylint] New Bug submitted (W0212 - faux positifs)

from
Ludovic Aubry <ludal at logilab dot fr>
to
subject
Re: [pylint] New Bug submitted (W0212 - faux positifs)
date
2006/01/16 17:41
On Mon, Jan 16, 2006 at 05:14:22PM +0100, Sylvain Thénault wrote:
> On Monday 16 January à 17:12, Aubry Ludovic wrote:
> > 
> > The following bug was submitted for project pylint : #10405 - W0212 - faux positifs
> > 
> > Bug description
> > ---------------
> > W0212 : Method could be a function
> > 
> > est apparemment émis lorsque la méthode n'utilise pas self mais c'est souvent le cas avec une factory method :
> > 
> > class XA: pass
> > class XB(XA): pass
> > class XC(XA): pass
> > 
> > class A:
> >     def MakeX(self):
> >         return XA()
> > 
> > class B(A):
> >     def MakeX(self):
> >         return XB()
> > 
> > class C(A):
> >     def MakeX(self):
> >         return XC()

> utilise une staticmethod ?
c'est pas forcément possible pour toutes les classes dérivées

class D(A):
    def MakeX(self):
        return XD(self.a)


-- 
Ludovic Aubry                                 LOGILAB, Paris (France).
http://www.logilab.com   http://www.logilab.fr  http://www.logilab.org


has reply
,