Is StopIteration a singleton?

Terry Reedy tjreedy at udel.edu
Thu Nov 20 22:40:21 EST 2014


On 11/20/2014 12:09 AM, Steven D'Aprano wrote:

> No idea. But you can marshal StopIteration itself, but not StopIteration
> instances:
>
> py> marshal.dumps(StopIteration)
> 'S'
> py> marshal.dumps(StopIteration())
> Traceback (most recent call last):
>    File "<stdin>", line 1, in <module>
> ValueError: unmarshallable object

Ditto for other exception classes I tried.

-- 
Terry Jan Reedy




More information about the Python-list mailing list