[Python-ideas] thoughts on generator.throw()

Arnaud Delobelle arnodel at googlemail.com
Wed Mar 18 20:55:41 CET 2009


On 18 Mar 2009, at 18:07, George Sakkis wrote:

> On Wed, Mar 18, 2009 at 1:42 PM, Leif Walsh <leif.walsh at gmail.com>  
> wrote:
>> On Wed, Mar 18, 2009 at 1:20 PM, Antoine Pitrou  
>> <solipsis at pitrou.net> wrote:
>>> - raise should be decently fast, which is easier with a dedicated  
>>> bytecode.
>>
>> Why does raise have to be decently fast?
>>
>> In my average case, at least, it's encountered at most once per
>> program execution.  Even if I was good about catching exceptions, the
>> point is that they're _exceptional_ cases, so they shouldn't be
>> happening very often.
>
> That's not always true; StopIteration comes to mind.

But StopIteration is not usually raised explicitly.

-- 
Arnaud




More information about the Python-ideas mailing list