Interesting little "gotcha" with generators

Aahz aahz at pythoncraft.com
Thu Dec 22 17:37:48 EST 2005


In article <7x1x04227y.fsf at ruckus.brouhaha.com>,
Paul Rubin  <http://phr.cx@NOSPAM.invalid> wrote:
>aahz at pythoncraft.com (Aahz) writes:
>>
>> What's wrong with
>> 
>>     def foo():
>>         if False: yield None
>
>Does the following work?
>
>    def foo():
>        raise StopIteration

Nope.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"Don't listen to schmucks on USENET when making legal decisions.  Hire
yourself a competent schmuck."  --USENET schmuck (aka Robert Kern)



More information about the Python-list mailing list