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:
On Fri, Nov 21, 2014 at 2:40 PM, Terry Reedy tjre...@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
On 11/20/2014 11:23 PM, Chris Angelico wrote:
On Fri, Nov 21, 2014 at 2:40 PM, Terry Reedy tjre...@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
While poking about the cpython source tree with reference to PEP 479,
I came across this:
https://docs.python.org/3.5/library/marshal.html
singletons None, Ellipsis and StopIteration can also be marshalled
and unmarshalled.
StopIteration is a type. I suppose it's still kinda true that there's
is it a singleton itself: StopIteration (the class) is an instance of
type, and there are *many* instances of type:
py all(isinstance(T, type) for T in [int, float, str, bool,
... Exception, StopIteration, dict, type])
True
I cannot imagine what they mean by calling StopIteration a singleton.
Why
into the argument for StopIteration.
Clearly so. Also, the special case is for StopIteration, not for its
type (just as there is for None, and not NoneType).
Nor is it a singleton itself: StopIteration (the class) is an instance of
type, and there are *many* instances of type:
py all(isinstance(T