Python: how to refer to an instance name?

后端 未结 4 1587
北恋
北恋 2021-01-14 01:45

I\'m collecting instances using the following code:

class Hand():
    instances = []
    def __init__(self):
        Hand.instances.append(self)
        self         


        
4条回答
  •  离开以前
    2021-01-14 02:19

    foo = Foo() means that the variable foo just points to the object returned by Foo(), there's no concept of name here.

提交回复
热议问题