Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:

I concur with Raymond.

NumPy is a third-party library, Python builtins can't depend on it. This could 
be solved by introducing a special protocol, but this isn't free. It adds a 
burden on writing and maintaining code and tests, and adds a runtime overhead 
of checking if the protocol is supported. This will slowdown sum() for every 
other collection. It can even slowdown it for short NumPy arrays.

And, as Raymond has noted, if introduce the __sum__ protocol, why not introduce 
protocols for min(), max(), sort(), all(), and for any other builtin? This has 
the same drawbacks as for sum(), but multiplied by many times.

If you use NumPy arrays just use NumPy array methods. Otherwise what is the 
reason of using NumPy?

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32895>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to