Python:定义自己的运算符? [英] Python: defining my own operators?

查看:148
本文介绍了Python:定义自己的运算符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想定义自己的运算符. python支持这样的事情吗?

I would like to define my own operator. Does python support such a thing?

推荐答案

否,您无法创建新的运算符.但是,如果您只是在评估表达式,则可以自己处理字符串并计算新运算符的结果.

No, you can't create new operators. However, if you are just evaluating expressions, you could process the string yourself and calculate the results of the new operators.

这篇关于Python:定义自己的运算符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆