[Python-checkins] r79584 - peps/trunk/pep-3101.txt
georg.brandl
python-checkins at python.org
Fri Apr 2 10:54:12 CEST 2010
Author: georg.brandl
Date: Fri Apr 2 10:54:11 2010
New Revision: 79584
Log:
Fix the NamespaceFormatter example in PEP 3101.
Modified:
peps/trunk/pep-3101.txt
Modified: peps/trunk/pep-3101.txt
==============================================================================
--- peps/trunk/pep-3101.txt (original)
+++ peps/trunk/pep-3101.txt Fri Apr 2 10:54:11 2010
@@ -595,9 +595,9 @@
if isinstance(key, str):
try:
# Check explicitly passed arguments first
- return kwds[name]
+ return kwds[key]
except KeyError:
- return self.namespace[name]
+ return self.namespace[key]
else:
Formatter.get_value(key, args, kwds)
@@ -607,7 +607,7 @@
fmt = NamespaceFormatter(globals())
greeting = "hello"
- print(fmt("{greeting}, world!"))
+ print(fmt.format("{greeting}, world!"))
A similar technique can be done with the locals() dictionary to
gain access to the locals dictionary.
More information about the Python-checkins
mailing list