Ben Darnell added the comment:

With the two changes I described things appear to be working, although I've 
only done light testing so far.

For inspect.isgenerator(), my use case is here: 
https://github.com/tornadoweb/tornado/blob/2971e857104f8d02fa9107a0e13f50170eb4f30d/tornado/gen.py#L222

I currently do isinstance(x, types.GeneratorType), which will fail if x is 
actually a GeneratorWrapper. I can change this to use collections.abc.Generator 
when it exists, but then I'd have to have some conditional logic to switch 
between collections.abc and types depending on what version I'm running on. It 
would be nice if that were encapsulated in inspect.isgenerator(). 

More generally, the inconsistency between isgenerator() and iscoroutine() is 
kind of odd. I would expect that either all inspect functions or none of them 
would use a suitable ABC if one exists.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24400>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to