[issue41848] PEG parser doesn't allow lambda in for_if_clause

2020-09-26 Thread Guido van Rossum


Guido van Rossum  added the comment:

Okay, let's close this.

--
resolution:  -> wont fix
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41848] PEG parser doesn't allow lambda in for_if_clause

2020-09-26 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I concur with Guido: it makes the grammar slightly more complex for no gain. 
Also, the originally allowed rule does not allow *any* lambda but only the ones 
that are simple, which is a special case that makes it even more complex. In 
any case you can use parentheses to break this limitation.

Like Guido, I propose to add a very small comment to What's New in 3.9

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41848] PEG parser doesn't allow lambda in for_if_clause

2020-09-25 Thread Guido van Rossum


Guido van Rossum  added the comment:

I propose not to fix this, since it is pointless (a lambda is always truthy).

We can call it out in What's New in 3.9 -- as a very small footnote. :-)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41848] PEG parser doesn't allow lambda in for_if_clause

2020-09-25 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

After adding parens,
>>> [x for x in [] if (lambda: x)]
[]

--
nosy: +terry.reedy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41848] PEG parser doesn't allow lambda in for_if_clause

2020-09-24 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
keywords: +patch
nosy: +BTaskaya
nosy_count: 6.0 -> 7.0
pull_requests: +21434
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22394

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41848] PEG parser doesn't allow lambda in for_if_clause

2020-09-24 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +benjamin.peterson, gvanrossum, pablogsal, serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41848] PEG parser doesn't allow lambda in for_if_clause

2020-09-23 Thread Sergei Lebedev


New submission from Sergei Lebedev :

Reproducer:

[x for x in [] if lambda: x]

This parses fine in 3.8, but doesn't parse in 3.9 because the grammar expects a 
disjunction after if in for_if_clause [*]. While this change has zero practical 
significance, I think it might be useful to maintain a list of such changes for 
tooling authors (who might need to support multiple Python versions).

[*]: 
https://github.com/python/cpython/blob/68526fe258da8c01196fd7cf48e8e5f1280bf8fd/Grammar/python.gram#L523

--
components: Interpreter Core
messages: 377435
nosy: lys.nikolaou, slebedev
priority: normal
severity: normal
status: open
title: PEG parser doesn't allow lambda in for_if_clause
type: behavior
versions: Python 3.10, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com