Re: [Tutor] Circular approach to a dictionary structure

2005-10-28 Thread Tim Johnson
* Andrei <[EMAIL PROTECTED]> [051028 15:57]: Andrei, I really like your approach. Will which up an object interface for it. Will have other applications, I'm sure. thanks tim > Tim Johnson wrote: > > Hello: > > > > # I have the following dictionary: > > next_phases = {"open":"review","review":"w

Re: [Tutor] Circular approach to a dictionary structure

2005-10-28 Thread Andrei
Tim Johnson wrote: > Hello: > > # I have the following dictionary: > next_phases = {"open":"review","review":"write","write":"open"} > > # a 'phase is extracted by > next_phase = next_phases[self.phase > > Note that the value for each of the first keys is the key for > the next item, and that th

Re: [Tutor] Circular approach to a dictionary structure

2005-10-28 Thread Tim Johnson
* Alan Gauld <[EMAIL PROTECTED]> [051028 14:05]: > Tim, > > I don;t know if theres a better way but > > > next_phases = {"open":"review","review":"write","write":"open"} > > > > Note that the value for each of the first keys is the key for > > the next item, and that the value for the last key i

Re: [Tutor] Circular approach to a dictionary structure

2005-10-28 Thread Alan Gauld
Tim, I don;t know if theres a better way but > next_phases = {"open":"review","review":"write","write":"open"} > > Note that the value for each of the first keys is the key for > the next item, and that the value for the last key is the *first* key. But I think this is pretty neat, I like it. N

Re: [Tutor] Circular approach to a dictionary structure

2005-10-28 Thread Tim Johnson
* Hugo González Monteverde <[EMAIL PROTECTED]> [051028 12:51]: > Hi, > > There may be, but I do not understand what is it exactly what you are > trying to do. > > If you're trying to implement a circular something that goes back to the > first element after iterating the last one, Yes. You

Re: [Tutor] Circular approach to a dictionary structure

2005-10-28 Thread Hugo González Monteverde
Hi, There may be, but I do not understand what is it exactly what you are trying to do. If you're trying to implement a circular something that goes back to the first element after iterating the last one, then I'd think of a list, and using some modulus when iterating. Can you explain more of

[Tutor] Circular approach to a dictionary structure

2005-10-28 Thread Tim Johnson
Hello: # I have the following dictionary: next_phases = {"open":"review","review":"write","write":"open"} # a 'phase is extracted by next_phase = next_phases[self.phase Note that the value for each of the first keys is the key for the next item, and that the value for the last key is the *first*