File tree 1 file changed +13
-2
lines changed 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -1344,8 +1344,19 @@ but exists for completeness' sake. The following operators are supported:
1344
1344
``{{ '=' * 80 }} `` would print a bar of 80 equal signs.
1345
1345
1346
1346
``** ``
1347
- Raise the left operand to the power of the right operand. ``{{ 2**3 }} ``
1348
- would return ``8 ``.
1347
+ Raise the left operand to the power of the right operand.
1348
+ ``{{ 2**3 }} `` would return ``8 ``.
1349
+
1350
+ Unlike Python, chained pow is evaluated left to right.
1351
+ ``{{ 3**3**3 }} `` is evaluated as ``(3**3)**3 `` in Jinja, but would
1352
+ be evaluated as ``3**(3**3) `` in Python. Use parentheses in Jinja
1353
+ to be explicit about what order you want. It is usually preferable
1354
+ to do extended math in Python and pass the results to ``render ``
1355
+ rather than doing it in the template.
1356
+
1357
+ This behavior may be changed in the future to match Python, if it's
1358
+ possible to introduce an upgrade path.
1359
+
1349
1360
1350
1361
Comparisons
1351
1362
~~~~~~~~~~~
You can’t perform that action at this time.
0 commit comments