[Python-Dev] Tricky way of of creating a generator via a comprehension expression (original) (raw)
Antoine Pitrou solipsis at pitrou.net
Sat Nov 25 02:11:51 EST 2017
- Previous message (by thread): [Python-Dev] Tricky way of of creating a generator via a comprehension expression
- Next message (by thread): [Python-Dev] Tricky way of of creating a generator via a comprehension expression
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sat, 25 Nov 2017 03:03:02 +0000 MRAB <python at mrabarnett.plus.com> wrote:
On 2017-11-25 02:21, Chris Jerdonek wrote: > On Fri, Nov 24, 2017 at 5:06 PM, Nathaniel Smith <njs at pobox.com> wrote: >> On Fri, Nov 24, 2017 at 4:22 PM, Guido van Rossum <guido at python.org> wrote: >>> The more I hear about this topic, the more I think that
await
,yield
and >>>yield from
should all be banned from occurring in all comprehensions and >>> generator expressions. That's not much different from disallowingreturn
>>> orbreak
. >> >> I would say that banningyield
andyield from
is like banning >>return
andbreak
, but banningawait
is like banning function >> calls. > > I agree. I was going to make the point earlier in the thread that > using "await" can mostly just be thought of as a delayed function > call, but it didn't seem at risk of getting banned until Guido's > comment so I didn't say anything (and there were too many comments > anyways). > > I think it's in a different category for that reason. It's much easier > to reason about than, say, "yield" and "yield from". > +1Seeing "await" there didn't/doesn't confuse me; seeing "yield" or "yield from" does.
+1 as well.
Regards
Antoine.
- Previous message (by thread): [Python-Dev] Tricky way of of creating a generator via a comprehension expression
- Next message (by thread): [Python-Dev] Tricky way of of creating a generator via a comprehension expression
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]