Re: [Python-Dev] Tricky way of of creating a generator via a comprehension expression

2017年11月24日 21:30:52 -0800

On Fri, Nov 24, 2017 at 9:04 PM, Nick Coghlan <[email protected]> wrote:
> def example():
> comp1 = yield from [(yield x) for x in ('1st', '2nd')]
> comp2 = yield from [(yield x) for x in ('3rd', '4th')]
> return comp1, comp2
Isn't this a really confusing way of writing
def example():
 return [(yield '1st'), (yield '2nd')], [(yield '3rd'), (yield '4th')]
?
-n
-- 
Nathaniel J. Smith -- https://vorpus.org
_______________________________________________
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