
On Fri, 29 Apr 2022 at 07:15, Zach Victor <zmvictor@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