[Numpy-discussion] Adding a 2D with a 1D array...

Citi, Luca lciti at essex.ac.uk
Thu Sep 10 04:42:55 EDT 2009


Hi Ruben,

> In both cases, as the print
> statement shows, offspr is already created.

>>> offspr[...] = r + a[:, None]
means "fill the existing object pointed by offspr with r + a[:, None]" while
>>> offspr = r + a[:,None]
means "create a new array and assign it to the variable offspr (after decref-ing the object previously pointed by offspr)"

Best,
Luca




More information about the NumPy-Discussion mailing list