On Fri, Apr 20, 2012 at 12:43 AM, Chris Angelico <ros...@gmail.com> wrote: > On Fri, Apr 20, 2012 at 2:38 PM, alex23 <wuwe...@gmail.com> wrote: >> On Apr 20, 5:54 am, Jacob MacDonald <jaccar...@gmail.com> wrote: >> >>> On Thursday, April 19, 2012 12:28:50 PM UTC-7, dmitrey wrote: >>> > can I somehow overload operators like "=>", "->" or something like >>> > that? >> >>> I don't believe that you could overload those particular operators, >>> since to my knowledge they do not exist in Python to begin with. >> >> It all depends on if the operators use special methods on objects: >> http://docs.python.org/reference/datamodel.html#special-method-names >> >> You can overload => via object.__le__, for example. > > Yes, but it will be a comparison operator, and to an extent, will be > assumed to function as one. I don't recommend abusing comparisons for > other operations - you'll confuse people no end. > > ChrisA > -- > http://mail.python.org/mailman/listinfo/python-list
Actually, the >= operator can't be spelled => anyway: >>> 3=>4 File "<stdin>", line 1 3=>4 ^ SyntaxError: invalid syntax -- ~Zahlman {:> -- http://mail.python.org/mailman/listinfo/python-list