On Thu, Jun 25, 2020 at 7:55 PM Christopher Barker <pythonchb@gmail.com> wrote:
On Thu, Jun 25, 2020 at 9:02 AM Steele Farnsworth <swfarnsworth@gmail.com> wrote:
indeed -- and that is pretty darn baked in to Python, so I don't think it's going to change.


Except this convention doesn't hold for dict.setvalue (which I did misspell, sorry), or for dict.pop. Both these methods fundamentally mutate the collection, but they also return a value (which could be retrieved by a non-mutating method), that somewhat pertains to the operation performed.
 
Note: I"n not sure your example with setdefault is correct:

Fair enough, I misspelled setdefault and messed up the example, what I meant was:
seen = {}
for k, v in iterable_of_tuples:
  if seen.setdefault(k,v) is not v:
    ... # duplicate key
  else:
    ... # new key