[Numpy-discussion] confusion on importing numpy
Wed Aug 6 05:50:14 CDT 2008
Anything that defeats the purpose of doing * imports is good in my book. :-)
Seriously, willy nilly import of any package into the base namespace
is just asking for trouble.
Tell your class to import numpy as np, then there will be no chance of
Then later tell them about "from numpy import min,max,array". Or
just have them do "min = np.min" etc.
On Wed, Aug 6, 2008 at 7:44 PM, mark <email@example.com> wrote:
> I guess that makes sense on a certain level, but boy it is cumbersome
> to explain to a class.
> It pretty much defeats the whole purpose of doing from numpy import *.
> On Aug 6, 12:03 pm, "Robert Kern" <robert.k...@gmail.com> wrote:
>> On Wed, Aug 6, 2008 at 05:00, mark <mark...@gmail.com> wrote:
>> > Hello list. I am confused about importing numpy.
>> > When I do
>> > from numpy import *
>> > and I try the min function, I get the default Python min function.
>> > On the other hand, when I do
>> > import numpy as np
>> > and use the np.min function, I get the numpy min function (which is
>> > obviously what I want).
>> > I know, the latter is preferred, but the former is so dang easy to
>> > type.
>> > I always thought both imports work the same, but I am obviously wrong.
>> > What's the difference?
>> We specifically exclude those names which would override builtins.
>> Robert Kern
>> "I have come to believe that the whole world is an enigma, a harmless
>> enigma that is made terrible by our own mad attempt to interpret it as
>> though it had an underlying truth."
>> -- Umberto Eco
More information about the Numpy-discussion