Why does django ORM's `save` method not return the saved object?

前端 未结 3 791
离开以前
离开以前 2020-12-09 07:11

Any insight into the reasoning behind this design decision? It seems to me that having obj.save() return something, has only benefits (like method chai

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-09 08:16

    This reminds me of the general principle that Greg Ward espoused at Pycon2015 recently, not to confuse functions with procedures. Every function should return a value or have a side-effect, but not both.

    Basically the same question is asked of dict.update().

提交回复
热议问题