Without the jinja2.ext.do
extension, you can do this:
{% set x=my_dict.__setitem__("key", "value") %}
Disregard the x
variable and use the dictionary which is now updated.
UPD: Also, this works for len()
(__len__()
), str()
(__str__()
), repr()
(__repr__()
) and many similar things.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…