On Fri, 29 Apr 2022 at 07:15, Zach Victor <zmvic...@gmail.com> wrote: > > I agree that "implicit" does not mean "code that one dislikes." The intent is > "delete entry if key exists." Is that implicit or explicit? >
"[R]emove specified key and return the corresponding value", with a default if there isn't one. Is that explicit enough? > Positing a default value to discard it as a return value is, arguably, what > makes the intent of that construction implicit. I say "arguably," because > that is the material that is under consideration (not whether one likes it). > You're welcome to create your own function to wrap it up, if you really think that that's a problem: def discard(dict, key): _ignoreme = dict.pop(key, None) del _ignoreme # because it's not explicit enough to just abandon an object Is that an improvement? ChrisA _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/SLGBV5OMN73WOLCRPYSL7DOZQBEZW2E3/ Code of Conduct: http://python.org/psf/codeofconduct/