[Python-Dev] Linked lists
Hello again. As I'm digging deeper into LISP and Scheme these days, I was wondering, is there a good compelling reason why in Python we don't have a native singly-linked and doubly-linked list types? That is, reasons other than - "you can get by without it" (sometimes I *want* lists), or - "you can use tuples to emulate lists" (only in limited contexts, and it's not pretty), or - "you can code your own in Python" (not as efficient as native types) Maybe I'm slapping an old horse here, but searching the archives I could not find some relevant controversy, that would--I hoped--include a final word from the BDFL. If I had "real" lists I would use them more often, where I now use Python lists (vectors, really). (Although In LISP I have the reverse problem, I tend to use lists sometimes where I should use arrays--I think I need to grow up). Anyway, why not provide good lists or cons-cell classes in C? ___ 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
Re: [Python-Dev] Linked lists
On Wed, Dec 14, 2005, Martin Blais wrote: > > As I'm digging deeper into LISP and Scheme these days, I was > wondering, is there a good compelling reason why in Python we don't > have a native singly-linked and doubly-linked list types? How about taking this dicussion to comp.lang.python and providing more examples of use cases. I think you should probably be able to throw together a PEP for a library without too much trouble, but it'll take a lot of convincing to make the push for a builtin type. As with sets and Decimal, plan on starting with a pure-Python module; finding one already in the wild that people use would be even better. -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/ "Don't listen to schmucks on USENET when making legal decisions. Hire yourself a competent schmuck." --USENET schmuck (aka Robert Kern) ___ 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
Re: [Python-Dev] Linked lists
Martin Blais wrote: > As I'm digging deeper into LISP and Scheme these days, I was > wondering, is there a good compelling reason why in Python we don't > have a native singly-linked and doubly-linked list types? As you seem to be asking for the historical reason: because nobody ever wanted it so badly to do anything about it. I would personally consider it a waste of energy to implement such a thing with so little use, given the alternatives. Regards, Martin ___ 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
Re: [Python-Dev] Linked lists
On 12/14/05, Martin Blais <[EMAIL PROTECTED]> wrote: > Hello again. > > As I'm digging deeper into LISP and Scheme these days, I was > wondering, is there a good compelling reason why in Python we don't > have a native singly-linked and doubly-linked list types? > > That is, reasons other than > - "you can get by without it" (sometimes I *want* lists), or > - "you can use tuples to emulate lists" (only in limited contexts, and > it's not pretty), or > - "you can code your own in Python" (not as efficient as native types) > > Maybe I'm slapping an old horse here, but searching the archives I > could not find some relevant controversy, that would--I hoped--include > a final word from the BDFL. > > If I had "real" lists I would use them more often, where I now use > Python lists (vectors, really). (Although In LISP I have the reverse > problem, I tend to use lists sometimes where I should use arrays--I > think I need to grow up). > > Anyway, why not provide good lists or cons-cell classes in C? So here's a word from the BDFL. :) I'm curious about the use cases you have in mind. Python's philosophy about (built-in) data types, inherited from ABC, is to offer a few powerful clearly distinct choices rather than lots of alternatives with overlapping usages. This reduces the time it takes to choose a data type and reduces the risk of picking the wrong type. (You seem to be indicating that this is indeed what's happening to you in Lisp. :-) In this philosophy, there is a real cost associated with offering more data types which isn't necessarily offset by the advantage. -- --Guido van Rossum (home page: http://www.python.org/~guido/) ___ 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