Antoine Pitrou wrote:

> Well... It really depends what kind of problem you're solving.  I
> certainly delete or pop items from dicts quite often.
> 
> Let's not claim that deleting items from a dict is a rare or advanced
> feature.  It is not.

+1.  It's a pretty common pattern for handling optional keyword
arguments, e.g. in subclass methods.

class Foo(Bar):
    def foo(self, *args **kws):
        mine = kws.pop('mine', None)
        super().foo(self, *args, **kws)
        do_something_myself(mine)

Now the question is, what guarantees does the language make about the
ordering of kws that Foo.foo() is passing to Bar.foo()?

-Barry

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
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