[Python-ideas] abc.optionalabstractmethod

Antoine Pitrou solipsis at pitrou.net
Thu Aug 2 17:46:04 CEST 2012


On Thu, 2 Aug 2012 09:26:59 -0600
Eric Snow <ericsnowcurrently at gmail.com>
wrote:
> Sometimes you want to specific an optional method in an abstract base
> class.  Currently we don't have a consistent way of doing so, instead
> having to mix in the old way of defining "abstract" methods:
> 
> class MyABC(metaclass=ABCMeta):
>     ...
> 
>     def do_something_optional(self):
>         """An optional method for doing something."""
>         raise NotImplementedError

What's the problem with it exactly?

Regards

Antoine.


-- 
Software development and contracting: http://pro.pitrou.net





More information about the Python-ideas mailing list