This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients rhettinger, serhiy.storchaka, urielias
Date 2018-02-21.18:44:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1519238680.61.0.467229070634.issue32895@psf.upfronthosting.co.za>
In-reply-to
Content
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?
History
Date User Action Args
2018-02-21 18:44:40serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger, urielias
2018-02-21 18:44:40serhiy.storchakasetmessageid: <1519238680.61.0.467229070634.issue32895@psf.upfronthosting.co.za>
2018-02-21 18:44:40serhiy.storchakalinkissue32895 messages
2018-02-21 18:44:40serhiy.storchakacreate