can I overload operators like "=>", "->" or something like that?

Ian Kelly ian.g.kelly at gmail.com
Thu Apr 19 15:51:32 EDT 2012


On Thu, Apr 19, 2012 at 1:28 PM, dmitrey <dmitrey15 at gmail.com> wrote:
> hi all,
> can I somehow overload operators like "=>", "->" or something like
> that? (I'm searching for appropriate overload for logical implication
> "if a then b")

No, because those aren't operators in Python.  You could overload ">="
(__ge__) or ">>" (__rshift__) or "|=" (__ior__).  Note that the last one
does an assignment even if you overload it.



More information about the Python-list mailing list