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 levkivskyi
Recipients gvanrossum, levkivskyi, pekka.klarck
Date 2018-09-06.10:01:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1536228092.68.0.56676864532.issue34568@psf.upfronthosting.co.za>
In-reply-to
Content
> but even then types in the typing could themselves implement `__instancecheck__` and `__subclasscheck__` and retain the old behavior.

It doesn't work that way. `__instancecheck__` and `__subclasscheck__` tweaks the behaviour of superclass (i.e. the right argument) in `isinstance()` and `issubclass()`. This is how `isinstance([], typing.Iterable)` works, you can't use the same to tweak `isinstance(typing.Iterable, type)`.

> Hopefully someone with more insight on this can comment my worries. Perhaps the attribute should also be documented as discussed earlier: https://github.com/python/typing/issues/335

No, it is not safe to use it and will not be documented. You missed the point of my previous post, the idea is to add public wrappers in typing that will hide `__origin__` (or whatever else) as an implementation detail. Using `__origin__` is OK however as a *temporary* measure, if you don't want to use `typing_inspect` in the meantime.
History
Date User Action Args
2018-09-06 10:01:32levkivskyisetrecipients: + levkivskyi, gvanrossum, pekka.klarck
2018-09-06 10:01:32levkivskyisetmessageid: <1536228092.68.0.56676864532.issue34568@psf.upfronthosting.co.za>
2018-09-06 10:01:32levkivskyilinkissue34568 messages
2018-09-06 10:01:32levkivskyicreate