[Python-Dev] Overloading comparison operator for lists

Montana Burr montana.burr at gmail.com
Sun May 26 23:52:17 EDT 2019

NumPy arrays have this awesome feature, where array == 3 does an
element-wise comparison and returns a list. For example:




It would be cool if Python had similar functionality for lists.

If that is not possible, perhaps we could consider allowing developers to
overload operators on built-in types within the context of a project or
module. For example, an overload in one module would have no effect on the
same operator in a different module (such as any Python standard modules.)
Additionally, let's then give the developers the option to explicitly
import an overload from other modules. So, people could develop a module
with the  purpose of providing overloads that make complete sense within a
certain context.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20190526/66e6b4c8/attachment.html>

More information about the Python-Dev mailing list