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 rhettinger
Recipients Ludovic.Gasc, gvanrossum, lukasz.langa, martin.panter, pitrou, rhettinger, scoder, vstinner, yselivanov
Date 2015-04-26.19:37:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In the lastest patch, the close() method is now a valid mixin method.  

However, the throw() method should be made abstract because it doesn't provide the required operation (it doesn't even use the "self" argument) or it should be left out entirely (i.e. Numba only supporting next()) if the presence of throw() is not required.

Going back to Stefan's original use case, the problem being solved is that isinstance(g, types.GeneratorType) rejects regular classes that implement send(), next(), throw(), and close(), presumably because it is going to call those methods and expect that they work.

If an object tests positive for isinstance(g,, what can we then assume about the object.  It would be weird to pass that test, see a throw() method, call it and have it do something other than raise an exception inside the generator.

    g = lazy_readline_from_connection('')
    if isinstance(g,
        # We passed the isinstance check, now what does that
        # actually mean?  What is guaranteed to work?
        g.close()    # Expect this to close the connection

If a working throw() isn't actually required, then the code ought to be checking for isinstance(obj, or somesuch; otherwise, was is the point of doing any checks for a generator-like object?

I don't think this patch should go in until it is capable of doing something meaningful.  Otherwise, it looks like at attempt to bluff its way past generator checks that were presumably there for a reason.
Date User Action Args
2015-04-26 19:37:49rhettingersetrecipients: + rhettinger, gvanrossum, pitrou, scoder, vstinner, lukasz.langa, Ludovic.Gasc, martin.panter, yselivanov
2015-04-26 19:37:49rhettingersetmessageid: <>
2015-04-26 19:37:49rhettingerlinkissue24018 messages
2015-04-26 19:37:49rhettingercreate