concise code (beginner)

bambam david at asdf.asdf
Mon Sep 10 03:58:54 CEST 2007


I can try that, but I'm not sure that it will work. The problem
is that devList is just a pointer to a list owned by someone else.
Making devList point to a new list won't work: I need to make
the parent list different. I could do this by adding an extra
level of indirection, but I think at the risk making the call
environment more complex.

Still, the main thing is that I hadn't even thought of doing it
that way.

Thank you,

Steve.


"Lawrence D'Oliveiro" <ldo at geek-central.gen.new_zealand> wrote in message 
news:fbqo83$8fd$1 at lust.ihug.co.nz...
> In message <13dv4uqqb806ff0 at corp.supernews.com>, bambam wrote:
>
>> The devices are in a list, and are removed by using pop(i). This
>> messes up the loop iteration, so it is actually done by setting a
>> flag on each device in the exception handler, with ANOTHER
>> loop after each write/read/calculate sequence.
>
> Why not just build a new list? E.g.
>
>    newdevs = []
>    for dev in devs :
>        ...
>        if not removing_dev :
>            newdevs.append(dev)
>        #end if
>    #end for
>    devs = newdevs 





More information about the Python-list mailing list