This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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 <1520508318.21.0.467229070634.issue33018@psf.upfronthosting.co.za>
In-reply-to
Content
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 collections.abc.Reversible 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.
History
Date User Action Args
2018-03-08 11:25:18izbyshevsetrecipients: + izbyshev, jab, methane, serhiy.storchaka, levkivskyi
2018-03-08 11:25:18izbyshevsetmessageid: <1520508318.21.0.467229070634.issue33018@psf.upfronthosting.co.za>
2018-03-08 11:25:18izbyshevlinkissue33018 messages
2018-03-08 11:25:18izbyshevcreate