4 ms·
You might want: foo = mapping.pop("foo", "default") It removes "foo" key from mapping if any. `foo` is "default" if "foo" is missing and `mapping["foo"]`
by d0mine 4y ago
You might want:
foo = mapping.pop("foo", "default")
It removes "foo" key from mapping if any. `foo` is "default" if "foo" is missing and `mapping["foo"]` otherwise.
Dictionary unpacking compatible with the match/case syntax could look like:
{"foo": foo, **rest} = mapping
It asserts that there is "foo" key in mapping and puts its value into `foo`.