A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2017-November/150318.html below:

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

[Python-Dev] The current dict is not an "OrderedDict" [Python-Dev] The current dict is not an "OrderedDict"Antoine Pitrou solipsis at pitrou.net
Tue Nov 7 10:14:12 EST 2017
On Tue, 7 Nov 2017 09:44:07 -0500
Yury Selivanov <yselivanov.ml at gmail.com> 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.
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4