Python Operators – Exploring New Operators in Python

operator-keywordoperatorspython

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 define ternary condition operators or rotate operators.)

Best Answer

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/

Related Question