questions regarding assignement and copy

Charles R Harris charlesr.harris at gmail.com
Wed Oct 18 12:49:38 EDT 2006


On 10/18/06, David Cournapeau <david at ar.media.kyoto-u.ac.jp> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20061018/7000799b/attachment-0001.html>
-------------- next part --------------
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
-------------- next part --------------
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


More information about the NumPy-Discussion mailing list