Issues

Issue #3093 resolved

MutableDict.setdefault doesn't return the new value

Thomas Hervé
created an issue

MutableDict.setdefault was recently changed to properly propagate changes, but it broke the dictionary interface by not returning the value. You should be able to do that with a dict:

a = {} a.setdefault('b', 1) += 1

But with the current MutableDict behavior, it will fail with a NoneError.

Comments (11)

  1. Log in to comment