]> git.ipfire.org Git - thirdparty/jinja.git/commitdiff
Replace lambda for 'dict' in with dict itself 400/head
authorPeter Harris <pete.alex.harris@gmail.com>
Fri, 23 Jan 2015 10:12:10 +0000 (10:12 +0000)
committerPeter Harris <pete.alex.harris@gmail.com>
Fri, 23 Jan 2015 10:12:10 +0000 (10:12 +0000)
lambda **kw: kw is not equivalent to the dict constructor. It is much less useful.
In particular it doesn't accept a sequence of pairs.
Why not put dict itself into the DEFAULT_NAMESPACE?
Principle of least surprise, etc.

jinja2/defaults.py

index a27cb80cbf060e73c963de71d5f595e0453830f5..3717a7223f6882de8393a63e7fdec449c85ee89b 100644 (file)
@@ -32,7 +32,7 @@ from jinja2.filters import FILTERS as DEFAULT_FILTERS
 from jinja2.tests import TESTS as DEFAULT_TESTS
 DEFAULT_NAMESPACE = {
     'range':        range_type,
-    'dict':         lambda **kw: kw,
+    'dict':         dict,
     'lipsum':       generate_lorem_ipsum,
     'cycler':       Cycler,
     'joiner':       Joiner