
On Mon, Jun 24, 2013 at 02:03:58PM -0400, Terry Reedy wrote:
print('{spam} and {eggs}'.format(locals()))
That should be print('{spam} and {eggs}'.format(**locals()))
Yes, you're right.
Why do you see an intended usage as an 'awful workaround'?
Mainly because I think it's magical and ugly and reduces readability. It's subjective, but I always use the also-ugly but less magical:
print('{spam} and {eggs}'.format(spam=spam, eggs=eggs))
print('{spam} and {eggs}'.format(=spam, =eggs))
It looks pretty hideous to me ;-).
I agree. :)
And it still has repetition ;-).
True, though it can be helpful to look at the function call and actually see what arguments are being passed in. Anyway, I do have plenty of code that suffers from function calls with f(x=x,y=y,z=z). Most of it is of the form that Greg Ewing pointed out, where one function passes arguments along to another function. I'm not sure if this is the right solution, and I agree that it's ugly, but there are use cases where it might help. I'm still probably -0 on it. -- Andrew McNabb http://www.mcnabbs.org/andrew/ PGP Fingerprint: 8A17 B57C 6879 1863 DE55 8012 AB4D 6098 8826 6868