[SciPy-user] What can be improved ?

Michael McNeil Forbes mforbes at physics.ubc.ca
Wed May 16 13:03:10 EDT 2007


>> On 16 May 2007, at 4:52 AM, Gael Varoquaux wrote:
...
> ... A python list is a chained list. Adding term to a list is  
> cheap. You could build up a list
> of lists, call it "data", and at the end do "data = array(data)".  
> (same remark for sample_reduction).

I don't think this is actually true with most python  
implementations.  I believe that lists are implemented as contiguous  
arrays:

http://www.python.org/doc/faq/general/#how-are-lists-implemented

However, lists are implemented efficiently for amortized insertion,  
so this is probably still a good recommendation.

Michael.





More information about the SciPy-User mailing list