def process_devs(devs, fun):
for dev in devs:
try:
fun(dev)
except:
print exception
remove dev from devs
return devs
process_devs(devs, lambda d: d.read1())
process_devs(devs, lambda d: d.read2())
...
On 9/5/07, bambam <[EMAIL PROTECTED]> wrote:
>
> I have about 30 pages (10 * 3 pages each) of code like this
> (following). Can anyone suggest a more compact way to
> code the exception handling? If there is an exception, I need
> to continue the loop, and continue the list.
>
> Steve.
>
> -----------------------------------
> for dev in devs
> try:
> dev.read1()
> except
> print exception
> remove dev from devs
>
> for dev in devs
> try:
> dev.read2()
> except
> print exception
> remove dev from devs
>
> for dev in devs
> try:
> dev.read3()
> except
> print exception
> remove dev from devs
>
> etc.
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
http://mail.python.org/mailman/listinfo/python-list