> On 31 Oct 2020, at 06:35, Steven D'Aprano <st...@pearwood.info> wrote:
> 
> I think we can promise that:
> 
> * if the mapping on the right has missing keys, no assignments occur;
> 
> * if the mapping on the right has extra keys, and there is no double 
>  star target to capture the extras, then no assignments occur;

Why must I always handle all keys in the dictionary?

I can think of cases where I want to pull more than 1 key out of a dictionary 
but do not care about the rest.

I have a dict containing config items. I just need a couple of the keys not all 
of them.
I have a JSON response and the code is only interested in some of the values 
returned.

For the pattern of passing **kwds down the __init__ chain I would clearly want 
to use the form:

{'myitem': self.myitem, **other_kwds} = kwds


> 
> * otherwise, assignments occur from left to right.

Barry

_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/ZEAGXTXNV3CM65MM6TCC2J53LM7EUKK3/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to