Author izbyshev
Recipients izbyshev, jab, levkivskyi, methane, serhiy.storchaka
Date 2018-03-08.11:25:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I do not see any point in allowing non-types in ABCMeta.__subclasscheck__. Currently, ABCs are clearly not designed to support non-types:

1. ABCMeta.register() accepts types only.
2. ABCMeta.__subclasscheck__ implicitly requires its arguments to support weak references (regardless of whether __subclasshook__ is called or not). This requirement alone doesn't make sense, so it seems to be an exposed implementation detail stemming from the fact that non-types were not intended to be supported.
3. Some ABC users already expect that the argument of __subclasshook__ is a type (see the example with by OP).
4. Attempting to support arbitrary arguments in ABC.__subclasscheck__ (by returning False instead of raising TypeError or worse) will not solve any 'issubclass' inconsistencies. 'issubclass' is fundamentally "fragmented": issubclass(x, y) may return True/False while issubclass(x, z) may raise TypeError, depending on __subclasscheck__ implementation. It may be too late to impose stricter requirements for the first argument of issubclass because 'typing' module relies on the support of non-types there.
Date User Action Args
2018-03-08 11:25:18izbyshevsetrecipients: + izbyshev, jab, methane, serhiy.storchaka, levkivskyi
2018-03-08 11:25:18izbyshevsetmessageid: <>
2018-03-08 11:25:18izbyshevlinkissue33018 messages
2018-03-08 11:25:18izbyshevcreate