首页 > 技术文章 > Python的类变量和成员变量、类静态方法和类成员方法

pluse 2017-09-13 21:34 原文

先说明几个相关的术语:attribute、function、method。

  • attribute:类对象的数据成员。我们经常会在Python代码出错时遇到:“AttributeError: 'My_Class' object has no attribute 'memberxxx'”
  • function:普通函数
  • method:类方法

示例代码:

 

推荐阅读