[Python-Dev] str.format_from_mapping (original) (raw)
Glenn Linderman v+python at g.nevcal.com
Sun Oct 31 23:54:24 CET 2010
- Previous message: [Python-Dev] str.format_from_mapping
- Next message: [Python-Dev] str.format_from_mapping
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 10/31/2010 3:32 PM, Eric Smith wrote:
On 10/31/2010 6:28 PM, Glenn Linderman wrote:
On 10/31/2010 2:02 PM, Benjamin Peterson wrote:
2010/10/31 Antoine Pitrou<solipsis at pitrou.net>:
> On Sun, 31 Oct 2010 16:39:44 -0400 > Eric Smith<eric at trueblade.com> wrote: >
>> What are your thoughts on adding a str.formatfrommapping (or similar >> name, maybe the suggested "formatmap") to 3.2? See >> http://bugs.python.org/issue6081 . This method would be similar to >> "%(foo)s %(bar)s" % d, where d is a dict (or rather any mapping object), >> but of course would use str.format syntax: "{foo} >> {bar}".formatfrommapping(d). > > I must be missing something, but what's the difference with > XXX.format(**d)? It allows arbitrary mappings. Other than the language moratorium, why are arbitrary mappings not allowed for the (**d) syntax? An arbitrary mapping would be converted to a dict.
Yes, but why convert? I suppose it has something to do with the case where there are named parameters, in addition to a **kwargs formal, and the mixing and matching that happens as a result. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20101031/2251861c/attachment-0001.html>
- Previous message: [Python-Dev] str.format_from_mapping
- Next message: [Python-Dev] str.format_from_mapping
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]