On Thu, Oct 1, 2020 at 7:51 AM William Pickard <lollol22...@gmail.com>
wrote:

> I have a suggestion for an API, how about a keyword argument to
> "abstractmethod" that allows to set the abstract method as "optional"
> meaning that sub-implementations can either implement their own version or
> use the ABC's own, infact, I think the STDLIB could use this itself (I
> haven't looked at the stdlib entirely).
>
> For native code, a new method flag would be required, probably something
> like "OPTIONAL_ABSTRACT" (I forget the naming convention for flags)
>
> example: @abstractmethod(True) # Method won't be included in required
> implementations. Default: False (for bcompat reasons)
>

That's already possible: just don't use @abstractmethod at all. You can
still override!

-- 
--Guido van Rossum (python.org/~guido)
*Pronouns: he/him **(why is my pronoun here?)*
<http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/OPZWRDSTKNXGUSQQKUP23MOHKUZTJT5R/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to