On May 9, 10:48 am, Paul Rubin <http://[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] writes: > > I have a dictionary of which i'm itervalues'ing through, and i'll be > > performing some logic on a particular iteration when a condition is > > met with trusty .startswith('foo'). I need to grab the previous > > iteration if this condition is met. I can do something with an extra > > var to hold every iteration while iterating, but this is hacky and not > > elegant. > > You cannot rely on the elements of a dictionary being in any > particular order (dicts are internally hash tables), so the above > is almost certainly ont what you want.
Hi - thanks for your reply. How about if I made the dict into a list (of which I have done). How would I then reference the previous item? Can they be indexed? -- http://mail.python.org/mailman/listinfo/python-list