Re: [Python-Dev] The current dict is not an "OrderedDict"

2017年11月07日 07:22:37 -0800

On Tue, 7 Nov 2017 09:44:07 -0500
Yury Selivanov <[email protected]> wrote:
> 
> One common pattern that I see frequently is this:
> 
> def foo(**kwargs):
> kwargs.pop('somekey', None)
> bar(**kwargs)
I see it frequently too, but that's in code meant to be
Python 2-compatible (and therefore cannot count on any ordering
guarantee, even de facto). On Python 3 you can write:
 def foo(somekey=None, **kwargs):
 # do something with somekey?
 bar(**kwargs)
Regards
Antoine.
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to