[Numpy-discussion] numpy.asum ?

Sebastian Haase seb.haase@gmail....
Mon Oct 5 14:55:01 CDT 2009


On Mon, Oct 5, 2009 at 8:43 PM, Robert Kern <robert.kern@gmail.com> wrote:
> On Mon, Oct 5, 2009 at 13:37, Sebastian Haase <seb.haase@gmail.com> wrote:
>> Thanks for the reply.
>> I thought one reason for amax was that
>> from numpy import *
>> would not not import max but only amax.
>
> I have my timelines confused. Numeric has neither amax() nor max(). I
> don't actually recall the sequence of events, then.
>
>> How about sum ?
>> Does "from numpy import *"
>> overwrite the builtin sum ?
>
> Try it.
>
>>> sum
<built-in function sum>
>>> from numpy import *
>>> sum
<function sum at 0x0334E2B0>
>>> asum
Traceback (most recent call last):
  File "<input>", line 1, in <module>
NameError: name 'asum' is not defined
>>> N.__version__
'1.3.0'
>>>

>> not to mention the "symmetry" / consistency argument for having "asum" ?
>
> At this point, I don't care to cater to "from numpy import *" use
> case. Too much code uses numpy.sum() remove it, or even deprecate it.
>

I did not mean to suggest to remove or deprecate it. I only remember
that there was a discussion - long time ago - that "from numpy import
*" (still common in many places, like interactive sessions) - should
not overwrite builtins ....
Personally, I would prefer to write np.amax and np.asum ... do you see
my argument for consistency here ?


- Sebastian


More information about the NumPy-Discussion mailing list