python 运算符 供重载参考

yipeiwu_com6年前Python基础
二元运算符 特殊方法
+ __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__

相关文章

python 监听salt job状态,并任务数据推送到redis中的方法

salt分发后,主动将已完成的任务数据推送到redis中,使用redis的生产者模式,进行消息传送 #coding=utf-8 import fnmatch,json,logging...

pyinstaller打包opencv和numpy程序运行错误解决

前言 这篇文章主要介绍了pyinstaller打包opencv和numpy程序运行错误解决,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考...

python 安装virtualenv和virtualenvwrapper的方法

1. 首先介绍pip常用命令 pip安装命令: pip install package_name pip升级命令:pip install –ungrage package_name...

python3利用Dlib19.7实现人脸68个特征点标定

python3利用Dlib19.7实现人脸68个特征点标定

0.引言 利用Dlib官方训练好的模型“shape_predictor_68_face_landmarks.dat”进行68点标定,利用OpenCv进行图像化处理,在人脸上画出68个点,...

pycharm运行scrapy过程图解

pycharm运行scrapy过程图解

这篇文章主要介绍了pycharm运行scrapy过程图解,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下 1.打开pycharm, 点击...