[Python-ideas] Operator for inserting an element into a list

Chris Angelico rosuav at gmail.com
Sun Jun 17 17:00:21 EDT 2018


On Mon, Jun 18, 2018 at 6:52 AM, Jelle Zijlstra
<jelle.zijlstra at gmail.com> wrote:
>
>
> 2018-06-17 13:09 GMT-07:00 Chris Angelico <rosuav at gmail.com>:
>>
>>
>> kwargs.pop("some_key") could plausibly be spelled del
>> kwargs["some_key"] if del were (like yield) upgraded to expression.
>> Whether that is an improvement or not, I don't know, but at least it's
>> logical.
>
> That already works. It calls the __delitem__ magic method.
>

Yes, but it's a statement. The point of kwargs.pop("some_key") is to
get the value of it.

x = del kwargs["some_key"] # doesn't work

ChrisA


More information about the Python-ideas mailing list