Is StopIteration a singleton?
Chris Angelico
rosuav at gmail.com
Thu Nov 20 23:23:46 EST 2014
On Fri, Nov 21, 2014 at 2:40 PM, Terry Reedy <tjreedy at udel.edu> wrote:
> 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.
I can't marshal any other exception instances, but I also can't
marshal any other exception classes. StopIteration is special-cased,
and I have no idea why.
ChrisA
More information about the Python-list
mailing list