concise code (beginner)
Lawrence D'Oliveiro
ldo at geek-central.gen.new_zealand
Fri Sep 7 01:40:19 EDT 2007
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