Eric Smith <e...@trueblade.com> added the comment:

It occurs to me that Raymond's use case could be satisfied using existing 
Python, by slightly changing the format string. After all, str.format() 
supports mapping lookup already:

$ ./python.exe
Python 2.6.5+ (release26-maint:79421, Mar 25 2010, 08:51:39)
[GCC 4.2.1 (Apple Inc. build 5646) (dot 1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> class Default(dict):
...  def __missing__(self, key):
...   return key
...
>>> s = '{m[name]} was born in {m[country]}'
>>> s.format(m=Default(name='Guido'))
'Guido was born in country'
>>>

Considering that, maybe the best thing is to do nothing. Or maybe update the 
documentation with this example.

Plus, you could mix and match this with *args as you'd like.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue6081>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to