[Python-ideas] raising an exception type doesn't instantiate it until it gets caught

Steven D'Aprano steve at pearwood.info
Mon Nov 7 11:15:33 CET 2011


Cameron Simpson wrote:

> I presume StopIteration would get instantiated to a singleton, like
> NoneType to None? Just asking.


Are you asking about what it should be, or what it is? Either way:

 >>> a = StopIteration('spam')
 >>> b = StopIteration('ham')
 >>> a is b
False



-- 
Steven



More information about the Python-ideas mailing list