When __repr__() is called?

前端 未结 4 1016
轻奢々
轻奢々 2021-01-17 10:08

print OBJECT calls OBJECT.__str__(), then when OBJECT.__repr__() is called? I see that print OBJECT calls OBJECT.__

4条回答
  •  粉色の甜心
    2021-01-17 10:52

    repr(obj) calls obj.__repr__.

    This is intended to clearly describe an object, specially for debugging purposes. More info in the docs

提交回复
热议问题