On 06/10/2021 23:53, Chris Angelico wrote:
On Thu, Oct 7, 2021 at 8:51 AM Thomas Jollans wrote:
On 03/10/2021 01:39, Chris Angelico wrote:
Using assignment expressions in lambda functions sometimes works, but
sometimes doesn't.
Does this commit by a certain Chris Angelico help clear things up
On Thu, Oct 7, 2021 at 8:51 AM Thomas Jollans wrote:
>
> On 03/10/2021 01:39, Chris Angelico wrote:
> > Using assignment expressions in lambda functions sometimes works, but
> > sometimes doesn't.
>
> Does this commit by a certain Chris Angelico help clear things up?
>
> https://github.com/python/
On 03/10/2021 01:39, Chris Angelico wrote:
Using assignment expressions in lambda functions sometimes works, but
sometimes doesn't.
Does this commit by a certain Chris Angelico help clear things up?
https://github.com/python/peps/commit/f906b988b20c9a8e7e13a2262f5381bd2b1399e2
--
https://mail.
On 2021-10-03 10:39:38 +1100, Chris Angelico wrote:
> # Oh, and it doesn't actually assign anything.
> >>> def f(n):
> ... return (lambda: (n := 1)), (lambda: n)
> ...
> >>> g, h = f(5)
> >>> h()
> 5
> >>> g()
> 1
> >>> h()
> 5
I thought about that one a bit more and I think that the lambda is
On 2021-10-03 10:39:38 +1100, Chris Angelico wrote:
> Using assignment expressions in lambda functions sometimes works, but
> sometimes doesn't.
> ... return lambda x: (x, x := 2, x)
syntax ok
> return lambda: n := 1
syntax error
> ... return lambda: (n := 1)
syntax ok
> return
Using assignment expressions in lambda functions sometimes works, but
sometimes doesn't.
Python 3.11.0a0 (heads/main:dc878240dc, Oct 3 2021, 10:28:40) [GCC
8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
# Fine if it's a parameter to the lambda function
>>>