[Numpy-discussion] Re: Trying out Numeric3

konrad.hinsen at laposte.net konrad.hinsen at laposte.net
Mon Mar 28 02:25:04 EST 2005

On 25.03.2005, at 23:52, Stephen Walton wrote:

> where str is a string is not allowed because strings are immutable.   
> But if I type "b=7" followed by "b=3", do I really care whether the 3  
> gets stuck in the same memory location previously occupied by the 7  
> (mutable) or the symbol b points to a new location containing a 3  
> (immutable)?  What are some circumstances where this might matter?
The most important one in practice is

	a = some_array[0]
	b = a
	a += 3

If the indexing operation returns a scalar (immutable), then "a" and  
"b" will have different values. If it returns a rank-0 (mutable), then  
"a" and "b" will be the same. This matters for code that is written  
with scalars in mind and which then gets fed rank-0 arrays as  

Konrad Hinsen
Laboratoire Leon Brillouin, CEA Saclay,
91191 Gif-sur-Yvette Cedex, France
Tel.: +33-1 69 08 79 25
Fax: +33-1 69 08 82 61
E-Mail: khinsen at cea.fr

More information about the NumPy-Discussion mailing list