Linked lists (was Re: Typing system vs. Java
tjreedy at home.com
Tue Aug 7 10:21:22 CEST 2001
"Ville Vainio" <vvainio at karhu.tp.spt.fi> wrote in message
news:yox3d74785g.fsf at karhu.tp.spt.fi...
> Which makes me think - why is there no linked list type?
We seem to do quite well without it.
> I don't care if I had to explicitly express that I want linked list,
> it just should be there.
If you have application where really advantageous, you can define
linked list class. Then you decide whether singly or doubly linked,
and whether to use cdr/car vs. first/rest. You can then derive
subclass with enforced limitation on item types.
You can also implement with lists (len=2 or 3) and functions.
Or you can write private C extension type (just don't expect it to be
added to standard) as others have done with other datatypes (example:
>Or is the concept problematic in Python, for some reason?
There must be dozens of special data structures that *could* be added.
Python comes with a few general types, efficiently implemented, that
allow creation of others. Also has relatively easy to use extension
Terry J. Reedy
More information about the Python-list