类方法 | 解释 |
---|---|
hasattr | hasattr(class) |
getattr | - |
setattr | - |
delattr | - |
- | - |
__getattr__ |
|
__setattr__ |
|
__delattr__ |
|
- | - |
__getattrbute__ |
如无异常,优先. 如有连带执行__getattr__ |
- | - |
__getitem__ |
obj[k] |
__setitem__ |
obj[k]=v |
__delitem__ |
del obj[key] |
- | - |
__doc__ |
文档 |
__module__ |
模块 |
__class__ |
obj属于哪类 |
- | - |
__init__ |
A() |
__call__ |
a() |
- | - |
__str__ |
print obj |
__repr__ |
print obj |
__format__ |
- |
- | - |
__del__ |
代码执行完后触发 |
__enter__ |
(with语句) |
__exit__ |
- |
- | - |
__get__ |
(描述符) |
__set__ |
- |
__delete__ |
- |
- | - |
__slots__ |
插槽 |
- | - |
__call__ |
- |
__metaclass__ |
- |