From: Charles R H. <cha...@gm...> - 2006-10-18 16:50:18
|
On 10/18/06, David Cournapeau <da...@ar...> wrote: > > Sven Schreiber wrote: > > > > Yes it's intended; as far as I understand the python/numpy syntax, <+> > > is an operator, and that triggers assignment by copy (even if you do > > something trivial as bar = +foo, you get a copy, if I'm not mistaken), > > > So basically, whenever you have > > foo = expr > > with expr is a numpy expression containing foo, you trigger a copy ? Yes. Numpy generates a temporary where the expression results are kept, the temporary is then assigned to foo. This can be inefficient, but knowing when you may overwrite data can be complicated. For instance: foo = dot(foo,foo) Can't be done in place because values needed later on in the dot evaluation would be overwritten. Chuck |