[Tutor] Linked List
shitizb at yahoo.com
Sat Mar 5 15:20:40 CET 2005
I could not understand what you exactly mean.
In order to explain wat my problem is, here is an
example code. Its not exactly what I am doing, I am
using multiple threads and a rather complicated code
so try and understand the sense rather than the code
>>> for i in myls:
The point is, the list(both size and elements) is
changing even as it is being operated upon.
This particular case goes into infinite loop at i=20.
Interestingly, I can freely edit the list yet to be
traversed, without any ill effects, which would not
have been possible if a python list was a pure
array(due to immutable length of an array in c).
--- "Jacob S." <keridee at jayco.net> wrote:
> I'm taking a shot in the dark and answering here.
> Have you tried making a copy of the list, iterating
> over the copy, and
> changing the original based on the copy?
> > Hi,
> > Any body has any idea on how to implement a linked
> > list in python?
> > Ordinary python lists are not quite the same. what
> > need is a list i can traverse through
> > without bothering about the indices, as another
> > process is continuously editing this list, by
> > inserting and deleting elements even as the list
> > being traversed.
> > Shitiz
> > __________________________________
> > Celebrate Yahoo!'s 10th Birthday!
> > Yahoo! Netrospective: 100 Moments of the Web
> > http://birthday.yahoo.com/netrospective/
> > _______________________________________________
> > Tutor maillist - Tutor at python.org
> > http://mail.python.org/mailman/listinfo/tutor
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
More information about the Tutor