类的构造、删除:
object.__new__(self, ...) object.__init__(self, ...) object.__del__(self)
二元操作符:
+ object.__add__(self, other) - object.__sub__(self, other) * object.__mul__(self, other) // object.__floordiv__(self, other) / object.__div__(self, other) % object.__mod__(self, other) ** object.__pow__(self, other[, modulo]) << object.__lshift__(self, other) >> object.__rshift__(self, other) & object.__and__(self, other) ^ object.__xor__(self, other) | object.__or__(self, other)
扩展二元操作符:
+= object.__iadd__(self, other) -= object.__isub__(self, other) *= object.__imul__(self, other) /= object.__idiv__(self, other) //= object.__ifloordiv__(self, other) %= object.__imod__(self, other) **= object.__ipow__(self, other[, modulo]) <<= object.__ilshift__(self, other) >>= object.__irshift__(self, other) &= object.__iand__(self, other) ^= object.__ixor__(self, other) |= object.__ior__(self, other)
一元操作符:
- object.__neg__(self) + object.__pos__(self) abs() object.__abs__(self) ~ object.__invert__(self) complex() object.__complex__(self) int() object.__int__(self) long() object.__long__(self) float() object.__float__(self) oct() object.__oct__(self) hex() object.__hex__(self) round() object.__round__(self, n) floor() object__floor__(self) ceil() object.__ceil__(self) trunc() object.__trunc__(self)
比较函数:
< object.__lt__(self, other) <= object.__le__(self, other) == object.__eq__(self, other) != object.__ne__(self, other) >= object.__ge__(self, other) > object.__gt__(self, other)
类的表示、输出:
str() object.__str__(self) repr() object.__repr__(self) len() object.__len__(self) hash() object.__hash__(self) bool() object.__nonzero__(self) dir() object.__dir__(self) sys.getsizeof() object.__sizeof__(self)
类容器:
len() object.__len__(self) self[key] object.__getitem__(self, key) self[key] = value object.__setitem__(self, key, value) del[key] object.__delitem__(self, key) iter() object.__iter__(self) reversed() object.__reversed__(self) in操作 object.__contains__(self, item) 字典key不存在时 object.__missing__(self, key)



