Are lists at least as efficient as dictionaries?

Chad Netzer cnetzer at sonic.net
Sat Aug 30 16:20:57 EDT 2003


On Sat, 2003-08-30 at 00:03, Jp Calderone wrote:

>   But as you removed from my original post, list.extend() exists.  All one
> has to do to retain the existing functionality of __iadd__ is name the
> method something else, then call it.  All the advantages, none of the
> confusing or difficult to track semantics.

True, however when working with large Matrices, I much prefer A += B, to
A.add(B), and the performance advantages with __iadd__ can be
substantial.

I prefer the original posters suggestion that self assignment be
ignored.  But I see your point about the more difficult semantics of
__iadd__.


-- 
Chad Netzer






More information about the Python-list mailing list