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

Serhiy Storchaka storchaka at gmail.com
Fri Apr 13 01:11:47 EDT 2018


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.



More information about the Python-ideas mailing list