Guido van Rossum wrote: > So why not .get(key, <sentinel>)? You can reuse the sentinel, and this way > it's a single call instead of two -- e.g. the code in Mapping implements both > __contains__() and get() by calling __getitem__() and catching KeyError.
Good point. Another option I've considered is using the `keys` method, since most non-dict mappings would get this called anyways for patterns with `**rest`. All the more reason why we should allow the implementation some flexibility. ;) _______________________________________________ Python-Dev mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/RLBJKQNWFOTCBSAJT47J7RO2K26ZFQAL/ Code of Conduct: http://python.org/psf/codeofconduct/
