[Numpy-discussion] Quick Question about Optimization

Christopher Barker Chris.Barker@noaa....
Wed May 21 13:23:21 CDT 2008

James Snyder wrote:
> b = np.zeros((1,30)) # allocates new memory and disconnects the view

This is really about how python works, not how numpy works:

np.zeros() -- creates a new array with all zeros in it -- that's the 
whole point.

b = Something -- binds the name "b" to the Something object. Name 
binding will never, ever, change the object the name used to be bound 
to. This has nothing to do with whether the object formally know as "b" 
is referencing the data from another array.

This is a nice write up of the concept of name binding in Python:



Christopher Barker, Ph.D.

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception


More information about the Numpy-discussion mailing list