Python class variables or class variables in general

前端 未结 4 2043
难免孤独
难免孤独 2021-01-25 09:48

From Dive into Python:

Class attributes are available both through direct reference to the class and through any instance of the class.

Clas

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-25 10:18

    Your are confused between declaration and instantiation.

    C is the name of a class you declared.

    v is an object, instantiated from c.

提交回复
热议问题