On Fri, Jan 29, 2010 at 11:25 PM, Stephen J. Turnbull <step...@xemacs.org> wrote: > Josiah Carlson writes: > > > Lisp lists are really stacks > > No, they're really (ie, concretely) singly-linked lists. > > Now, stacks are an abstract data type, and singly-linked lists provide > an efficient implementation of stacks. But that's not what linked > lists "really are". For example, singly-linked lists are also a > reasonable way to implement inverted trees (ie, the node knows its > parent, but not its children), which is surely not a stack. > > The Python use of "list" to denote what is concretely a dynamically > extensible one-dimensional array confused me a bit. But what the > heck, Guido needed a four-letter word to denote a concrete type used > to implement a mutable sequence ADT, and he wasn't going to borrow one > from that French guy on the ramparts, right? No big deal. Ahem... > > So the confusion here is that in Python, "list" denotes a particular > concrete data type, while Steve H. is using a more abstract idea of > list as mutable sequence to suggest there's a reason for optimizing > certain mutations that Python's data type isn't good at. I don't > think that's an effective way for him to make his point, unfortunately. > But both usages are consistent with Python's usage; mutability is the > usual way that lists are distinguished from tuples, for example, and > the underlying dynamic array implementation is rarely mentioned.
My experience with Lisp is limited to mzScheme and DrScheme, but AFAIR, neither of them had mutable lists. Both had list semantics that were equivalent (in terms of limitations and functionality) to the structure I described using tuples in my earlier post. If other Lisp implementations have mutable lists, I'd be surprised to learn that. However, now we are well into the weeds, far off the track of whether or not Steve H's feature is worth saddling Python lists with cruft. - Josiah _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com