about array,arange
Shi Mu
samrobertsmith at gmail.com
Sat Nov 12 08:32:29 EST 2005
On 11/12/05, Robert Kern <robert.kern at gmail.com> wrote:
> Shi Mu wrote:
> > i got confused by the use of array and arange.
> > arange get array and range get list, why we need the two different types?
>
> When you're asking questions about a third-party module, it's a good
> idea to mention the module. In this case you're asking about scipy_core
> (hopefully) or else numarray or Numeric.
>
> The answer to your question is that sometimes we need to get largish
> arrays (not lists) of consecutive numbers quickly. array(range(N)) is
> wasteful of memory and time because it has to create a list of Python
> ints that are simply going to be thrown away once we're done converting
> to the needed array.
>
> --
> Robert Kern
> rkern at ucsd.edu
still not clear. can you give an example?
Thanks! it is from numeric module (really confused by the documentation)
More information about the Python-list
mailing list