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"))

{'username': 'display_name', 'setups': 'setups', 'x': 1, 'y': 2, 'z': 3}

This doesn't work with tools, so I would be very annoyed if I had to work with this.

An IDE friendly implementation can be found here:


Despite having written these, I've never actually used them. Such magic would not be OK at work or in a library. But I've wanted to use them so many times, and a method blessed by the Python language and community would be so great.