>
> 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 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:
https://github.com/alexmojaki/sorcery#dict_of
https://github.com/alexmojaki/sorcery/blob/master/sorcery/spells.py#L245
https://github.com/alexmojaki/sorcery/blob/master/sorcery/spells.py#L515
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.
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/DTAOMPXH5QBNHQVSCK3CD3RD4WGLI4RP/
Code of Conduct: http://python.org/psf/codeofconduct/