[Python-ideas] raising an exception type doesn't instantiate it until it gets caught
Nick Coghlan
ncoghlan at gmail.com
Mon Nov 7 13:01:24 CET 2011
On Mon, Nov 7, 2011 at 5:52 PM, Cameron Simpson <cs at zip.com.au> wrote:
>
> I presume StopIteration would get instantiated to a singleton, like
> NoneType to None? Just asking.
Even without the traceback issue Antoine mentioned, it's already the
case that StopIteration isn't a singleton in 2.x. Various pieces of
code (e.g. contextlib.contextmanager) rely on being able to tell
whether they're getting a specific StopIteration instance back or a
new one.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-ideas
mailing list