[issue33346] Syntax error with async generator inside dictionary comprehension

2021-07-13 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: New changeset 054e9c84ac7c394941bba3ea1829d14dce1243fc by Serhiy Storchaka in branch 'main': bpo-33346: Allow async comprehensions inside implicit async comprehensions (GH-6766)

[issue33346] Syntax error with async generator inside dictionary comprehension

2020-06-30 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: Yeah, I am +1 on moving this and on the current solution in PR6766 -- ___ Python tracker ___

[issue33346] Syntax error with async generator inside dictionary comprehension

2020-06-29 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: What can I do to move this issue forward? We already missed 3.7, 3.8 and 3.9. -- ___ Python tracker ___

[issue33346] Syntax error with async generator inside dictionary comprehension

2019-06-01 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: Ping, should we include this in beta1 or as is a "bugfix" this can be backported? -- ___ Python tracker ___

[issue33346] Syntax error with async generator inside dictionary comprehension

2019-03-06 Thread Nathaniel Smith
Nathaniel Smith added the comment: > Except that your first example (an asynchronous generator in a synchronous > comprehensions) is allowed in the current code and can occur inside a > synchronous function. Oh yeah, you're right of course. --

[issue33346] Syntax error with async generator inside dictionary comprehension

2019-03-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It is what PR 6766 implements, Nathaniel. Except that your first example (an asynchronous generator in a synchronous comprehensions) is allowed in the current code and can occur inside a synchronous function. --

[issue33346] Syntax error with async generator inside dictionary comprehension

2019-03-06 Thread Josh Rosenberg
Change by Josh Rosenberg : -- nosy: +josh.r ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue33346] Syntax error with async generator inside dictionary comprehension

2019-03-06 Thread Yury Selivanov
Yury Selivanov added the comment: Yes, I have exactly the same thoughts as Nathaniel about this. The bug should be fixed, and the algorithm should be as follows (quoting Nathaniel): > So, I would expect the rule to be, precisely: if an async list/dict/set > comprehension occurs inside

[issue33346] Syntax error with async generator inside dictionary comprehension

2019-03-04 Thread Nathaniel Smith
Nathaniel Smith added the comment: There are some tricky subtleties here around the distinction between list/dict/set comprehensions and generator expressions. For list/dict/set comprehensions, they're evaluated eagerly, so an async comprehension can only occur in async context. For

[issue33346] Syntax error with async generator inside dictionary comprehension

2019-03-04 Thread Guido van Rossum
Guido van Rossum added the comment: Hm, I think that if Yury still thinks this is a good idea you two should just do this. No need to write a PEP or wait for the Steering Committee. Unless there's a downside? Does it break real existing code? -- nosy: +gvanrossum

[issue33346] Syntax error with async generator inside dictionary comprehension

2018-09-22 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +xtreak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue33346] Syntax error with async generator inside dictionary comprehension

2018-09-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: What is the status of this issue? Similar change to the Grammar was just merged in issue32117. Both issue32117 and this issue extend already implemented PEPs (PEP 448 and PEP 525 correspondingly) to the corner case missed in the original PEP. Pablo,

[issue33346] Syntax error with async generator inside dictionary comprehension

2018-07-08 Thread Guido van Rossum
Change by Guido van Rossum : -- nosy: -gvanrossum ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue33346] Syntax error with async generator inside dictionary comprehension

2018-07-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: PR 6766 adds numerous examples of nesting async generator expressions and comprehensions as tests. -- ___ Python tracker ___

[issue33346] Syntax error with async generator inside dictionary comprehension

2018-05-14 Thread Guido van Rossum
Guido van Rossum added the comment: Is there any problem that is solved by allowing this example? The asymmetry with using [...async for...] in the same position (which is not allowed) worries me. Do you have a real use case where it's clearer to write an async generator

[issue33346] Syntax error with async generator inside dictionary comprehension

2018-05-14 Thread Yury Selivanov
Yury Selivanov added the comment: > Did you mean {} for the outer brackets intead of []? Yes, my bad. > All of these should only be allowed inside 'async def' though, right? Yep, except async generator expressions which are allowed to appear in synchronous contexts,

[issue33346] Syntax error with async generator inside dictionary comprehension

2018-05-14 Thread Guido van Rossum
Guido van Rossum added the comment: > [f: [x async for x in f(x)] for f in fs] Did you mean {} for the outer brackets intead of []? I think it is reasonable that if the presence of 'async for' or 'await' in a comprehension makes it async, then this should also apply if that

[issue33346] Syntax error with async generator inside dictionary comprehension

2018-05-14 Thread Yury Selivanov
Yury Selivanov added the comment: [Serhiy] > But asynchronous comprehensions should behave the same way as 'await'. I > think that a comprehension should be made implicitly asynchronous if any of > inner expressions contains explicit or implicit asynchronous

[issue33346] Syntax error with async generator inside dictionary comprehension

2018-05-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: There are several related PEPs: PEP 492 -- Coroutines with async and await syntax PEP 525 -- Asynchronous Generators PEP 530 -- Asynchronous Comprehensions I haven't found anything explicit about this case. PEP 492 says that

[issue33346] Syntax error with async generator inside dictionary comprehension

2018-05-11 Thread Guido van Rossum
Guido van Rossum added the comment: @Ivan: Please stop bringing up that we should drop the implicit scope for comprehensions. I know you feel this way, but it's not going to happen. @Serhiy: What does the PEP for async/await say? (Or is there a separate PEP for allowing

[issue33346] Syntax error with async generator inside dictionary comprehension

2018-05-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think this can be fixed simpler. Currently a comprehension become asynchronous in two cases: 1. Explicitly, when it contains 'async for'. This is visible at AST level. 2. Implicitly, when any of inner expressions contains

[issue33346] Syntax error with async generator inside dictionary comprehension

2018-05-11 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +6452 stage: -> patch review ___ Python tracker ___

[issue33346] Syntax error with async generator inside dictionary comprehension

2018-05-03 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: My guess this is a consequence of the implicit function scope in comprehensions, see https://bugs.python.org/issue3692 I would say a proper solution would be to drop the implicit function scope in favour of other mechanisms, but this

[issue33346] Syntax error with async generator inside dictionary comprehension

2018-04-24 Thread Eric N. Vander Weele
Change by Eric N. Vander Weele : -- nosy: +ericvw ___ Python tracker ___ ___

[issue33346] Syntax error with async generator inside dictionary comprehension

2018-04-24 Thread Pablo Galindo Salgado
New submission from Pablo Galindo Salgado : Given this async function: async def elements(n): yield n yield n*2 yield n*3 yield n*4 This definition is considered invalid: async def test(): return { n: [x async for x in elements(n)] for n in range(3)}