if i only wanted the last element ofthe list, i would change the "geoCode.getResults()' to return to me both the complete list & the new elements in the list. it should be pretty easy from there. if what you need is to sort the list & see whether a value have changed or not then you will be better off working with dictionaries.
On Wed, Apr 23, 2008 at 6:26 AM, Vaibhav.bhawsar <[EMAIL PROTECTED]> wrote: > i have this code to print every new element in a list only when the list > length changes (while the list is updated by a thread running elsewhere)...I > was wondering if there is a pythonic way to do this? how does one know when > there is a new element in the list? > > prevlength = 0 > while geoCode.running: > places = geoCode.getResults() #returns a list with most up to date > elements..the list grows as the thread that updates it > if len(places) > prevlength: > print places[prevlength] > prevlength = len(places) > > > thank you! > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > >
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor