class NumString:
def __init__(self, value):
self.value = str(value) def __str__(self):
return self.value def __int__(self):
return int(self.value) def __float__(self):
return float(self.value) def __add__(self, other):
if '.' in self.value:
return float(self) + other
return int(self) + other def __radd__(self, other):
return self + other def __iadd__(self, other):
self.value = self + other
return self.value def __mul__(self, other):
return int(self) * other def __rmul__(self, other):
return self * other def __imul__(self, other):
self.value = self * other
return self.value

Python内置数学函数的更多相关文章

  1. Python内置方法/函数

    abs() 返回数字的绝对值. abs(x) all() 用于判断给定的可迭代参数 iterable 中的所有元素是否都为 TRUE,如果是返回 True,否则返回 False. 元素除了是 0.空. ...

  2. python 内置常用函数

    import os def set(o): return set(o) # =={o} def reverseObject(it): it.reverse() return it def sortOb ...

  3. python 内置操作函数

  4. python内置函数的归集

    作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明. Python内置(built-in)函数随着python解释器的运行而创建.在Pytho ...

  5. Python补充03 Python内置函数清单

    作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明. Python内置(built-in)函数随着python解释器的运行而创建.在Pytho ...

  6. python基础9 -----python内置函数2

    一.python内置所以函数     Built-in Functions     abs() divmod() input() open() staticmethod() all() enumera ...

  7. Python补充--Python内置函数清单

    Python内置函数 Python内置(built-in)函数随着python解释器的运行而创建.在Python的程序中,你可以随时调用这些函数,不需要定义.最常见的内置函数是: print(&quo ...

  8. Python内置函数系列

    Python内置(built-in)函数随着python解释器的运行而创建.在Python的程序中,你可以随时调用这些函数,不需要定义. 作用域相关(2) locals()  :以字典类型返回当前位置 ...

  9. Python内置函数清单

    作者:Vamei 出处:http://www.cnblogs.com/vamei Python内置(built-in)函数随着python解释器的运行而创建.在Python的程序中,你可以随时调用这些 ...

随机推荐

  1. restful风格接口类型和优点

    从事web开发工作有一小段时间,REST风格的接口,这样的词汇总是出现在耳边,然后又没有完全的理解,您是不是有和我相同的疑问呢?那我们一起来一探究竟吧! 就是用URL定位资源,用HTTP描述操作. 知 ...

  2. 如何在Sketch 54 for mac创建符号?

    Sketch 54 for mac是Mac系统平台上一个出色的数字设计绘图软件,小巧而不失功能齐全, 简约而不失强大!从最初的想法到最终的艺术品,可以通过Sketch 54 for mac来实现!现本 ...

  3. 2017 ACM-ICPC乌鲁木齐网络赛 B. Out-out-control cars(计算几何 直线相交)

    题目描述 Two out-of-control cars crashed within about a half-hour Wednesday afternoon on Deer Park Avenu ...

  4. JS中数据结构之字典

    字典是一种以键 - 值对形式存储数据的数据结构 通过数组实现字典 function Dictionary() { this.add = add; this.datastore = new Array( ...

  5. ckeditor实现WORD粘贴图片自动上传

    自动导入Word图片,或者粘贴Word内容时自动上传所有的图片,并且最终保留Word样式,这应该是Web编辑器里面最基本的一个需求功能了.一般情况下我们将Word内容粘贴到Web编辑器(富文本编辑器) ...

  6. Python基础教程(013)--一行代码不要做多件事情

    前言 学习代码编写风格 内容 语法错误报错的信息 SystaxErrot:invalid syntax 语法错误, invalid 无效 每行代码负责完成一个动作 阅读代码,从左至右,从上到下. 学习 ...

  7. asd的甩锅计划

    asd的甩锅计划 时间限制: 1 Sec  内存限制: 128 MB提交: 177  解决: 19[提交][状态] 题目描述 大家对hdu上面的畅通工程系列一定很熟悉了吧.比如如下一段,就是畅通工程里 ...

  8. 术语-Portal:Portal(Web站点)

    ylbtech-术语-Portal:Portal(Web站点) Portal作为网关服务于因特网的一种WEB站点.Portal是链路.内容和为用户可能找到的感兴趣的信息(如新闻.天气.娱乐.商业站点. ...

  9. PHP-Redis扩展安装(四)

    PHP-Redis扩展安装(四) 安装环境链接:http://pan.baidu.com/s/1i4IbJox Memecached 服务器安装(一) memcached php扩展(二) redis ...

  10. Red Gate .NET Reflector

    Debug and decompile inside Visual Studio (VSPro edition) Use the Visual Studio debugger Use your reg ...