Re: [Python-Dev] PEP 479: Change StopIteration handling inside generators

2014年11月22日 18:33:07 -0800

On 11/22/2014 05:11 PM, Raymond Hettinger wrote:
>> On Nov 22, 2014, at 2:45 PM, Chris Angelico wrote:
>>
>> Does your middleware_generator work with just a single element,
>> yielding either one output value or none?
> 
> I apologize if I didn't make the point clearly. The middleware example was 
> just simple outline of calling next(), doing some processing, and yielding a
> result while letting the StopIteration float through from the next() call.
[middleware example]
 def middleware_generator(source_generator):
 it = source_generator()
 input_value = next(it)
 output_value = do_something_interesting(input_value)
 yield output_value
The point that Chris made that you should be refuting is this one:
>> What happens if do_something_interesting happens to raise
>> StopIteration? Will you be surprised that this appears identical to
>> the source generator yielding nothing?
--
~Ethan~

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to