Write class such that print(instance) returns all instance variables

后端 未结 0 614
你的背包
你的背包 2021-02-04 13:53

I\'m writing a class, and I want this behavior:

a = f(10,20)
print(a.row) # returns 10
print(a.col) # returns 20
print(a)     # returns a tuple of 10, 20  <--          


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题