Re: REALLY need help with iterating a list.

2007-06-11 Thread Fredrik Lundh
Radamand wrote: >> while serverlist: >> still_active = [] >> for server in serverlist: >> pinger = ping[server] >> if pinger.returncode is None: >> pinger.poll() >> still_active.append(server) >> else: >> pingresult[server] = pi

Re: REALLY need help with iterating a list.

2007-06-11 Thread Gabriel Genellina
En Mon, 11 Jun 2007 17:11:23 -0300, Radamand <[EMAIL PROTECTED]> escribió: > On Jun 11, 1:23 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: >> here's a simple variation of that, which is a bit more efficient, and >> perhaps also a bit easier to use in the general case: >> >> while serverlist: >>

Re: REALLY need help with iterating a list.

2007-06-11 Thread Radamand
On Jun 11, 12:59 pm, infidel <[EMAIL PROTECTED]> wrote: > On Jun 11, 11:30 am, Radamand <[EMAIL PROTECTED]> wrote: > > > > > This has been driving me buggy for 2 days, i need to be able to > > iterate a list of items until none are left, without regard to which > > items are removed. I'll put t

Re: REALLY need help with iterating a list.

2007-06-11 Thread Radamand
On Jun 11, 1:23 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > infidel wrote: > > How about something like this? > > > while serverlist: > > server = serverlist.pop(0) > > pinger = ping[server] > > if pinger.returncode==None: > > pinger.poll() > > serverlist.append(serve

Re: REALLY need help with iterating a list.

2007-06-11 Thread Fredrik Lundh
infidel wrote: > How about something like this? > > while serverlist: > server = serverlist.pop(0) > pinger = ping[server] > if pinger.returncode==None: > pinger.poll() > serverlist.append(server) > else: > pingresult[server] = pinger.stdout.read() >

Re: REALLY need help with iterating a list.

2007-06-11 Thread infidel
On Jun 11, 11:30 am, Radamand <[EMAIL PROTECTED]> wrote: > This has been driving me buggy for 2 days, i need to be able to > iterate a list of items until none are left, without regard to which > items are removed. I'll put the relevant portions of code below, > please forgive my attrocious nam

Re: REALLY need help with iterating a list.

2007-06-11 Thread alg
Reverse iteration should do the trick, if I understand your problem: for server in reversed(serverlist): ... else: serverlist.remove(server) On Jun 11, 11:30 am, Radamand <[EMAIL PROTECTED]> wrote: > This has been driving me buggy for 2 days, i need to be able to > iterate a l