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 gvanrossum, lukasz.langa, martin.panter, pitrou, rhettinger, scoder, vstinner, yselivanov
Date 2015-04-21.02:21:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
For the other ABCs, if you define the required abstract methods, you get working versions of all the mixin methods.

In the case of the Generator ABC, throw() and close() are useless empty stub methods.  In the other ABCs, we leave optional methods out entirely.  A user should expect that if isinstance(g, Generator) is true that all of the ABC methods will work.

Also, the return StopIteration in throw() doesn't seem correct.  Shouldn't it raise the exception that was thrown?

    >>> def f():
            yield x

    >>> g = f()
    >>> g.throw(KeyError)

    Traceback (most recent call last):
      File "<pyshell#11>", line 1, in <module>
      File "<pyshell#9>", line 1, in f
        def f():

Ideally, there should be a practical example of where this ABC would be useful with anything other than a real generator.
Date User Action Args
2015-04-21 02:21:57rhettingersetrecipients: + rhettinger, gvanrossum, pitrou, scoder, vstinner, lukasz.langa, martin.panter, yselivanov
2015-04-21 02:21:57rhettingersetmessageid: <>
2015-04-21 02:21:57rhettingerlinkissue24018 messages
2015-04-21 02:21:56rhettingercreate