[New-bugs-announce] [issue16831] Better docs for ABCMeta.__subclasshook__
Nick Coghlan
report at bugs.python.org
Tue Jan 1 04:21:37 CET 2013
New submission from Nick Coghlan:
Authors of __subclasshook__ methods need to decide between returning True, False and NotImplemented in various cases. Making that decision requires a clear understanding that the checks in ABCMeta.__subclasscheck__ occur in the following order:
- explicit registrations
- the __subclasshook__ call
- ordinary inheritance
So, returning False from __subclasshook__ allows you to override normal rules of inheritance, while returning NotImplemented lets normal inheritance rules apply. Explicit registrations take precedence regardless.
----------
messages: 178724
nosy: ncoghlan
priority: normal
severity: normal
status: open
title: Better docs for ABCMeta.__subclasshook__
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16831>
_______________________________________
More information about the New-bugs-announce
mailing list