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~ -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: OpenPGP digital signature URL: <http://mail.python.org/pipermail/python-dev/attachments/20141122/4b33ea6b/attachment.sig>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4