A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2013-September/129071.html below:

[Python-Dev] Why not support user defined operator overloading ?

[Python-Dev] Why not support user defined operator overloading ?Stephen J. Turnbull stephen at xemacs.org
Sun Sep 29 19:03:57 CEST 2013
张佩佩 writes:

 > If we can overloading these operators, why we can't overloading
 > other operators?  (like .* often used in matrix, U in set
 > operation)

AIUI, it's considered unpythonic.  Operators are considered to be part
of the *syntax* of Python, unlike Haskell, where infix syntax can be
used for any function, and operators can be called via function
syntax.  (The latter is true in Python as well, but it is very bad
form to do that, sufficiently verbose that it is hardly tempting, and
it can easily fail because Python operators are polymorphic, but the
implementations via class methods are not.)

I'm sure it also simplifies parsing.

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4