Kevin Squire wrote: > On Tue, Aug 5, 2014 at 4:08 AM, Neal Becker > <[email protected]> wrote: > >> Thanks. I don't think that's really equivalent though. I believe >> python's list >> is not contiguous, and can efficiently handle insertions and deletions, >> both at >> the ends and in the middle. Julia's array is a contiguous dense array, >> correct? > > > This is correct, although Ivar's comment is still valid. > > Julia's arrays are contiguous, and handle insertions and deletions at the > beginning and end pretty efficiently. The Queue type in the > DataStructures.jl package is implemented similarly to Python lists, and is > slightly faster yet at handling insertions and deletions at the beginning > and end, but (being a queue) doesn't handle anything in between (i.e., no > random access, I think, and no insertions/deletions in the middle). > > In theory, a Python like List type could be developed starting with the > Queue, though there would be tradeoffs. Like the Queue type, it would > likely be faster with insertions/deletions at the beginning and end, as > well as in the middle of the list. However, it would have slower element > access, and would not be usable for any linear algebra operations > (anything in Julia which calls BLAS/Lapack), because it wouldn't be > contiguous. > Still might be worth exploring. > > Cheers, > Kevin
So for the common idiom of growing a list of items by appending to the end, a plain old julia array is just great.
