Python has many solid example's of properly applied data structures, with nice encapsulated high-level interfaces. It's a good language to learn if you're interested in the application of data structures.
For instance you have your standard list, which IIRC is implemented as a dynamically allocated array of pointers to Python objects. This gives very fast append and pop operations on it's right side, making it a wonderful stack. However it's interface specifically lacks a dedicated prepend/appendleft operation, because appending to the left of the array involves shifting the entire structure over one place in memory. This is a very slow operation, because it must copy the entire structure to simply insert a single element. Python get's away with append on the right, by allocating a bit of extra "padding" memory on the right side, to avoid having to copy the structure. For the situation where you want to append to either side, Python offers `collections.deque`. This structure is implemented with a linked list of pointers, IIRC. Which gives very fast append operations from either side, because adding a new element only involves "hooking" the new element to the preferred side, kind of like a chain.
However for understanding how these structures are implemented C based languages are the way to go.
> For instance you have your standard list, which IIRC is implemented as a dynamically allocated array of pointers to Python objects. This gives very fast append and pop operations on it's right side, making it a wonderful stack. However it's interface specifically lacks a dedicated prepend/appendleft operation, because appending to the left of the array involves shifting the entire structure over one place in memory. This is a very slow operation, because it must copy the entire structure to simply insert a single element. Python get's away with append on the right, by allocating a bit of extra "padding" memory on the right side, to avoid having to copy the structure.
Not quite sure I get this. What's this got to do with Python? Arrays, or more specifically resizing arrays, are supposed to work like what you just described. Appends are constant time and you almost always have extra memory because of the resizing nature. Is this different in other languages?
Basically Python offers many nice interfaces, which encourage relatively efficient use of the underlying implementation. It would be trivial to implement an `appendleft` method for Python's list type (you could compose `list.insert`), but its omission was a good design choice, in my opinion. The language tries to guide you toward using the more appropriate data structure for the task, in this case a dedicated queue type. There're are numerous other similar examples scattered throughout the language. The way Python applies it's data structures is really well though out, and shows a great deal of attention to detail. There's a lot of wisdom wrapped up in Python's design choices, which I believe helps aspiring coders pick up solid techniques.
This isn't to say that Python is somehow, the be-all end-all language, but it's a very nice language, with many nice aspects to learn from.
The post you are challenging might make more sense if you understand, for example, that many people are using low-level languages that do not offer efficient implementations of data structures, or that "list" types are typically implemented as linked lists in a tradition that goes back to Lisp if not beyond.
For instance you have your standard list, which IIRC is implemented as a dynamically allocated array of pointers to Python objects. This gives very fast append and pop operations on it's right side, making it a wonderful stack. However it's interface specifically lacks a dedicated prepend/appendleft operation, because appending to the left of the array involves shifting the entire structure over one place in memory. This is a very slow operation, because it must copy the entire structure to simply insert a single element. Python get's away with append on the right, by allocating a bit of extra "padding" memory on the right side, to avoid having to copy the structure. For the situation where you want to append to either side, Python offers `collections.deque`. This structure is implemented with a linked list of pointers, IIRC. Which gives very fast append operations from either side, because adding a new element only involves "hooking" the new element to the preferred side, kind of like a chain.
However for understanding how these structures are implemented C based languages are the way to go.