> For calling, we can use 
> https://docs.python.org/3/library/functions.html#locals 
>
>       >>> lcls = locals() 
>
>       >>> a = 'apple' 
>       >>> b = 'banana' 
>       >>> c = 'cherry' 
>
>       >>> dict((k, lcls[k]) for k in ('a', 'b', 'c')) 
>       {'b': 'banana', 'c': 'cherry', 'a': 'apple'} 
>
> So in his example 
>
>        foo(a=a, b=b, c=c, d=3, e=e) 
>
> one could instead write 
>
>       foo(d=3, **helper(locals(), ('a', 'b', 'c', 'e'))) 
>
> or perhaps better 
>
>     helper(locals(), 'a', 'b', 'c', 'e')(foo, d=3) 
>
> where the helper() picks out items from the locals(). And in the 
> second form, does the right thing with them. 
>

Sure. This was the argument against f-strings too. 

In any case I'm not trying to solve a problem of how to extract things from 
the local namespace anymore than "foo(a, b)" is. I'm trying to minimize the 
advantage positional arguments have over keyword arguments in brevity. If 
that makes sense?
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to