Message244942
The new collections.abc.Awaitable ABC relies on __instancecheck__, which makes it incompatible with functools.singledispatch (singledispatch works based on args[0].__class__; any instance-level information is discarded). This surprised me because the first thing I tried to do with Awaitable was add it to my singledispatch-based coroutine compatibility layer.
Ideally coroutine would be an actual subclass of generator, instead of a generator with an extra bit set on the instance that changes how it answers isinstance() checks. That would be a big change, though, so it might be better to just document that Awaitable is kind of unusual (if we weren't already in the beta period I might argue that the ABCs should be removed and we should just use the functions in the inspect module instead). |
|
Date |
User |
Action |
Args |
2015-06-07 05:06:54 | Ben.Darnell | set | recipients:
+ Ben.Darnell, gvanrossum, vstinner, yselivanov |
2015-06-07 05:06:53 | Ben.Darnell | set | messageid: <1433653613.86.0.241600441921.issue24400@psf.upfronthosting.co.za> |
2015-06-07 05:06:53 | Ben.Darnell | link | issue24400 messages |
2015-06-07 05:06:52 | Ben.Darnell | create | |
|