Shitiz Bansal wrote on Fri, 4 Mar 2005 09:19:41 -0800 (PST): > Any body has any idea on how to implement a linked > list in python?
Perhaps like this: >>> class node(object): ... def __init__(self, item, next=None): ... self.item = item ... self.next = next >>> a = node('item a') >>> b = node(3) >>> c = node((3,4)) >>> d = node('last item') >>> a.next = b >>> b.next = c >>> c.next = d >>> mynode = a >>> while mynode: ... print mynode.item ... mynode = mynode.next item a 3 (3, 4) last item -- Yours, Andrei ===== Real contact info (decode with rot13): [EMAIL PROTECTED] Fcnz-serr! Cyrnfr qb abg hfr va choyvp cbfgf. V ernq gur yvfg, fb gurer'f ab arrq gb PP. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor