当前位置: 首页 > 图文教程 > 脚本技术 > Python > python 运算符 供重载参考

Python
python 正则式使用心得
python 正则式 概述及常用字符
用python分割TXT文件成4K的TXT文件
python getopt 参数处理小示例
python 运算符 供重载参考
python 查找文件夹下所有文件 实现代码
打印出python 当前全局变量和入口参数的所有属性
python 解析html之BeautifulSoup
python self,cls,decorator的理解
python 自动提交和抓取网页
python 域名分析工具实现代码
Python 文件重命名工具代码
python 提取文件的小程序
Python 网络编程说明
python 简易计算器程序,代码就几行
python encode和decode的妙用
Python开发编码规范
学习python (1)
学习python (2)
简明 Python 基础学习教程

Python 中的 python 运算符 供重载参考


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-11   浏览: 214 ::
收藏到网摘: n/a

二元运算符及其对应的特殊方法
二元运算符 特殊方法
+ __add__,__radd__
- __sub__,__rsub__
* __mul__,__rmul__
/ __div__,__rdiv__,__truediv__,__rtruediv__
// __floordiv__,__rfloordiv__
% __mod__,__rmod__
** __pow__,__rpow__
<< __lshift__,__rlshift__
>> __rshift__,__rrshift__
& __and__,__rand__
^ __xor__,__rxor__
| __or__,__ror__
+= __iaddr__
-= __isub__
*= __imul__
/= __idiv__,__itruediv__
//= __ifloordiv__
%= __imod__
**= __ipow__
<<= __ilshift__
>>= __irshift__
&= __iand__
^= __ixor__
|= __ior__
== __eq__
!=,<> __ne__
> __get__
< __lt__
>= __ge__
<= __le__