
On Tue, Jun 25, 2013 at 02:50:27AM +0900, Stephen J. Turnbull wrote:
Andrew McNabb writes:
I've seen people use an awful workaround for this:
print('{spam} and {eggs}'.format(locals()))
While it looks a little magical, the proposed syntax would be an improvement (especially when there are many arguments):
print('{spam} and {eggs}'.format(=spam, =eggs))
You're proposing that the "awful" workaround be made magical, builtin, and available to be used in any situation whether appropriate or not?
No, I'm not. That would look like this:
print('{spam} and {eggs}'.format())
And it would be an extraordinarily bad idea. However, the OP proposed something else, so I'm not sure how relevant this is. I'm not even sure I like it, but many of the responses have denied the existence of the use case rather than criticizing the solution.
I'll take the explicit use of locals any time.
I don't think anyone likes the idea of magically passing locals into all function calls. -- Andrew McNabb http://www.mcnabbs.org/andrew/ PGP Fingerprint: 8A17 B57C 6879 1863 DE55 8012 AB4D 6098 8826 6868