Message 245129 - Python tracker

Message245129

Author Ben.Darnell
Recipients Ben.Darnell, Yury.Selivanov, asvetlov, gvanrossum, ncoghlan, scoder, vstinner, yselivanov
Date 2015-06-10.14:31:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1433946670.84.0.727602826969.issue24400@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2015-06-10 14:31:10Ben.Darnellsetrecipients: + Ben.Darnell, gvanrossum, ncoghlan, scoder, vstinner, asvetlov, Yury.Selivanov, yselivanov
2015-06-10 14:31:10Ben.Darnellsetmessageid: <1433946670.84.0.727602826969.issue24400@psf.upfronthosting.co.za>
2015-06-10 14:31:10Ben.Darnelllinkissue24400 messages
2015-06-10 14:31:10Ben.Darnellcreate