[Numpy-discussion] List of Lists in C
Mon Jan 26 03:01:57 CST 2009
Correct, however other areas of the application expect an empty list to be
present, otherwise I would have used None.
2009/1/26 Matthieu Brucher <email@example.com>
> 2009/1/26 Hanni Ali <firstname.lastname@example.org>:
> > Yes fair point, but when it's a empty list and new elements are replaced
> > with a new list instance it's fine, especially as []*100000 is
> > significantly faster than [ for i in xrange(100000)] as I was
> > doing.
> In this case, why do you put a list in it in the first place ? You
> could put None, and it would be safer ;)
> > In fact I think that's partly answered my question []*x must create a
> > of pointers pointing at the same list. Rather than [ for i in
> > xrange(100000)] which must create a list of new separate lists instances.
> > Hence the significant difference in speed.
> > Hanni
> I agree. Less memory allocations and initialization, thus more speed.
> Information System Engineer, Ph.D.
> Website: http://matthieu-brucher.developpez.com/
> Blogs: http://matt.eifelle.com and http://blog.developpez.com/?blog=92
> LinkedIn: http://www.linkedin.com/in/matthieubrucher
> Numpy-discussion mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion