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

Karl Knechtel zahlman at gmail.com
Fri Apr 20 00:43:24 EDT 2012


On Thu, Apr 19, 2012 at 3: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")
> Thank you in advance, D.
> --
> http://mail.python.org/mailman/listinfo/python-list


There is no "logical implication" operator in Python, and indeed
Python doesn't really work that way; you can use a condition to
trigger an action, and you can have a conditionally-valued expression,
but you don't tell Python a bunch of facts and then expect it to
reason from those - that's Prolog.

You cannot invent your own operators for Python, either. Again, this
isn't something that programming languages commonly support.

Could you please tell us more about what you're **really** trying to do?

-- 
~Zahlman {:>



More information about the Python-list mailing list