On Fri, Nov 8, 2019 at 10:57 PM Antoon Pardon <antoon.par...@vub.be> wrote: > > On 7/11/19 18:10, Stephen Waldron wrote: > > What I'm aiming for is the ability to, within a function call, pass a suite > > that would be there automatically defined by the compiler/interpreter. > > Another comment did mention lambda functions, which does to some degree > > provide that capability, but is restricted to well, lambda functions (only > > expressions, not statements). > I don't think those restrictions are that limiting. Certainly not since > python3.8 and python acquired an assigment operator. And you should also > note that a list is an expression. So we could do something like the > following. >
If you're implying that you can rewrite any function using lambda and a list of expressions, then no, the ":=" operator won't help you: >>> (lambda: x := 1) File "<stdin>", line 1 SyntaxError: cannot use named assignment with lambda ChrisA -- https://mail.python.org/mailman/listinfo/python-list