How expensive are list and tuple slicing?

Chad Netzer cnetzer at mail.arc.nasa.gov
Tue May 13 14:42:20 EDT 2003


On Mon, 2003-05-12 at 20:40, Alex wrote:

> Thanks.  I guess that means I had better take care when writing recursive
> functions that operate on large lists.

Note that Python Numeric arrays implement slices as 'views' into the
original array (ie. changing the sliced array changes the original as
well.)  Some view this as an unfortunate departure from Python
semantics, but it does have some performance benefits, particularly in
situations like you describe above.  Just FYI.

http://www.pfdubois.com/numpy/

-- 

Chad Netzer
(any opinion expressed is my own and not NASA's or my employer's)






More information about the Python-list mailing list