Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #81047
| Date | 2014-11-20 12:52 +1100 |
|---|---|
| Subject | Is StopIteration a singleton? |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.16002.1416448354.18130.python-list@python.org> (permalink) |
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 only one StopIteration class (otherwise exception handling would get very messy), but it seems unusual that this one particular exception class should be special-cased. (And yes, the code does correspond - marshal.c:293 handles StopIteration with its own byte code.) Why is StopIteration marshallable but no other exception is? Or, if they are marshallable, why does this one get special handling? ChrisA
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Is StopIteration a singleton? Chris Angelico <rosuav@gmail.com> - 2014-11-20 12:52 +1100
Re: Is StopIteration a singleton? Steven D'Aprano <steve@pearwood.info> - 2014-11-20 05:09 +0000
Re: Is StopIteration a singleton? Chris Angelico <rosuav@gmail.com> - 2014-11-20 16:16 +1100
Re: Is StopIteration a singleton? Terry Reedy <tjreedy@udel.edu> - 2014-11-20 22:40 -0500
Re: Is StopIteration a singleton? Chris Angelico <rosuav@gmail.com> - 2014-11-21 15:23 +1100
Re: Is StopIteration a singleton? Terry Reedy <tjreedy@udel.edu> - 2014-11-20 23:54 -0500
csiph-web