Message101692
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. |
|
Date |
User |
Action |
Args |
2010-03-25 13:00:20 | eric.smith | set | recipients:
+ eric.smith, rhettinger, ezio.melotti, r.david.murray, gruszczy, ebehar |
2010-03-25 13:00:20 | eric.smith | set | messageid: <1269522020.6.0.3927200936.issue6081@psf.upfronthosting.co.za> |
2010-03-25 13:00:19 | eric.smith | link | issue6081 messages |
2010-03-25 13:00:18 | eric.smith | create | |
|