
On Apr 17, 2020, at 13:07, David Mertz <mertz@gnosis.cx> wrote:
I'm kinda leaning -0.5 even on the form that I think is least bad (the mode switch approach).
If typing the same variable from the caller to use in the parameter is really too much repetition, you could maybe just do this:
render_template("index.html", ... username="display_name", ... setups="setups", ... **Q("x y z")) ('index.html',) {'username': 'display_name', 'setups': 'setups', 'x': 1, 'y': 2, 'z': 3}
This is somewhat reminiscent of the argument that we don’t need any new magic for str.format because you can (and people did) just use the existing version that takes keywords and **locals() into it. The consensus there was that, even though that makes the magic explicit, it makes it too magical, and should be considered and anti-pattern, and we should try even harder for a better way to eliminate it, and ultimately that’s where f-strings came from. And the explicit magic didn’t even require frame-hacking in that case. I’m not sure how much that parallel means (or even what it would imply if it did mean a lot). I think I’m still -0.5, and the fact that you can get the same effect if you’re willing to use CPython frame hacks doesn’t make me either more or less negative.