[Python-ideas] Inline Functions - idea
Ethan Furman
ethan at stoneleaf.us
Wed Feb 5 23:26:54 CET 2014
On 02/05/2014 02:15 PM, Steven D'Aprano wrote:
>
> This ought to work and be much nicer:
>
> def saveline(a, b, **kwargs):
> # kwargs accumulates all the other, unused, locals from the caller.
> return a + b
Yup, and that's what I proposed in my other email. ;)
> I think what Alex is describing is a type of function which operates
> using *dynamic scoping*, rather than static/lexical scoping like Python
> functions normally do.
Possibly, but it's easy enough to simulate (at least in a read-only fashion) with **locals().
--
~Ethan~
More information about the Python-ideas
mailing list