A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2010-November/105127.html below:

[Python-Dev] str.format_from_mapping

[Python-Dev] str.format_from_mappingBenjamin Peterson benjamin at python.org
Mon Nov 1 00:20:07 CET 2010
2010/10/31 Glenn Linderman <v+python at g.nevcal.com>:
> 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.format_from_mapping (or similar
>>>  name, maybe the suggested "format_map") 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}".format_from_mapping(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?

Because callees always get a dictionary *copy* of the arguments.



-- 
Regards,
Benjamin
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4