New operators in Python

前端 未结 3 1165
离开以前
离开以前 2021-01-13 05:58

We can define intrinsic operators of Python as stated here. Just for curiosity, can we define new operators like $ or ***? (If so, then we can defi

3条回答
  •  渐次进展
    2021-01-13 06:33

    As @minitech said you can't define new operators. But check this hack that allows you to define infix operators http://code.activestate.com/recipes/384122-infix-operators/

提交回复
热议问题