[Python-projects] What is preferred way to indicate stub methods?

Benjamin Niemann pink at odahoda.de
Tue Jan 22 21:34:48 CET 2008


On Tuesday 22 January 2008, Emin.shopper Martinian.shopper wrote:
> Dear Experts,
>
> How do you indicate stub methods so pylint doesn't complain?
>
> For example, I often define classes as shown below but get various pylint
> warnings such as R0201 (method could be a function). I could disable the
> appropriate warnings, but I'm wondering if there is a better way to define
> such stub-methods.
>
> class BaseClass:
>   def __init__(self,member):
>      self.member = member
>
>  def double(self):
>      "Sub-classes should override this to return a doubled version of
> member."
>      return NotImplemented

IIRC methods with a body 'raise NotImplementedError' are treated as 'abstract' 
methods.

HTH

-- 
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://pink.odahoda.de/


More information about the Python-Projects mailing list