Python中的部分特殊属性

本文介绍了Python中类的各种内置属性,包括类名(__name__)、模块名(__module__)、类命名空间(__dict__)、基类(__bases__)及文档字符串(__doc__),帮助读者更好地理解和使用这些特性。

__name__ is the class name;   返回类名

__module__ is the module name in which the class was defined;   定义此类的模块名

 __dict__ is the dictionary containing the class’s namespace;   由类的命名空间组成的字典

__bases__ is a tuple (possibly empty or a singleton) containing the base classes, in the order of their occurrence in the base class list;   一个由基本类组成的数组(也许是空的或只有一个成员),按基类列表中出现的顺序排列

 __doc__ is the class’s documentation string, or None if undefined.  类的文档字符串,如果没有定义的话,为空。

转载于:https://www.cnblogs.com/saolv/p/6913276.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值