<div dir="ltr">In which way would this be different to {**mapping1, **mapping2, **mapping3} ?</div><div class="gmail_extra"><br><div class="gmail_quote">On 8 April 2018 at 22:18, Andrés Delfino <span dir="ltr"><<a href="mailto:adelfino@gmail.com" target="_blank">adelfino@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">
<div dir="ltr"><div><div><div>Hi!<br><br></div>I thought that maybe dict could accept several mappings as positional arguments, like this:<br></div><div><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">class Dict4(dict):<br> def __init__(self, *args, **kwargs):<br> if len(args) > 1:<br> if not all([isinstance(arg, dict) for arg in args]):<br> raise TypeError('Dict4 expected instances of dict since multiple positional arguments were passed')<br><br> temp = args[0].copy()<br><br> for arg in args[1:]:<br> temp.update(arg)<br><br> super().__init__(temp, **kwargs)<br> else:<br> super().__init__(*args, **kwargs)<br></blockquote><br></div>AFAIK, this wouldn't create compatibility problems, since you can't pass two positional arguments now anyways.<br><br></div>It
would be useful to solve the "sum/union dicts" discussion, for
example: requests.get(url, params=dict(params, {'foo': bar})<br><br>
Whar are your thoughts?</div>
</div>
<br>______________________________<wbr>_________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/<wbr>codeofconduct/</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr">Daniel F. Moisset - <span style="font-size:small">UK Country Manager - Machinalis Limited</span><div><a href="http://www.machinalis.com" target="_blank">www.machinalis.co.uk</a></div><div>Skype: @dmoisset T: <span style="background-color:transparent;font-family:Arial;font-size:8pt;white-space:pre-wrap">+ 44 7398 827139</span></div><div><span><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:8pt;font-family:Arial;background-color:transparent;vertical-align:baseline;white-space:pre-wrap">1 Fore St, London, EC2Y 9DT</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent;font-family:Arial;font-size:8pt;white-space:pre-wrap">Machinalis Limited is a company registered in England and Wales. Registered number: 10574987.</span></p></span></div></div></div></div></div></div>
</div>