[Python-ideas] Accepting multiple mappings as positional arguments to create dicts

Andrés Delfino adelfino at gmail.com
Fri Apr 13 11:08:08 EDT 2018


Oh, I get it now, thanks!

On Fri, Apr 13, 2018 at 2:11 AM, Serhiy Storchaka <storchaka at gmail.com>
wrote:

> 12.04.18 22:42, Andrés Delfino пише:
>
>> I think the update method can (and personally, should) stay unchanged:
>>
>> spam.update(dict(x, y))
>>
>> seems succinct and elegant enough, with the proposed constructor syntax.
>>
>> Sorry my ignorance, do (Mutable)Mapping ABC say anything about
>> constructors?
>>
>
> Mapping and MutableMapping ABCs don't have constructors, but many
> dict-like objects imitate the dict constructor: accept a single mapping or
> a sequence of pairs as a positional argument, and accept other dict as
> kwargs.
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180413/c89805e7/attachment-0001.html>


More information about the Python-ideas mailing list