Re: exceptions and items in a list

2005-01-10 Thread vincent wehren
Steve Holden wrote: vincent wehren wrote: rbt wrote: If I have a Python list that I'm iterating over and one of the objects in the list raises an exception and I have code like this: try: do something to object in list except Exception: pass Does the code just skip the bad object and cont

Re: exceptions and items in a list

2005-01-10 Thread Steve Holden
vincent wehren wrote: rbt wrote: If I have a Python list that I'm iterating over and one of the objects in the list raises an exception and I have code like this: try: do something to object in list except Exception: pass Does the code just skip the bad object and continue with the other

Re: exceptions and items in a list

2005-01-10 Thread Peter Hansen
rbt wrote: Andrey Tatarinov wrote: # skip bad object and continue with others for object in objects: try: #do something to object except Exception: pass Thanks Andrey. That's a great example of how to do it. Actually, it's not really a "great" example, since it catches _all_

Re: exceptions and items in a list

2005-01-10 Thread rbt
Andrey Tatarinov wrote: rbt wrote: If I have a Python list that I'm iterating over and one of the objects in the list raises an exception and I have code like this: try: do something to object in list except Exception: pass Does the code just skip the bad object and continue with the othe

Re: exceptions and items in a list

2005-01-10 Thread vincent wehren
rbt wrote: If I have a Python list that I'm iterating over and one of the objects in the list raises an exception and I have code like this: try: do something to object in list except Exception: pass Does the code just skip the bad object and continue with the other objects in the list,

Re: exceptions and items in a list

2005-01-10 Thread Andrey Tatarinov
rbt wrote: If I have a Python list that I'm iterating over and one of the objects in the list raises an exception and I have code like this: try: do something to object in list except Exception: pass Does the code just skip the bad object and continue with the other objects in the list,

exceptions and items in a list

2005-01-10 Thread rbt
If I have a Python list that I'm iterating over and one of the objects in the list raises an exception and I have code like this: try: do something to object in list except Exception: pass Does the code just skip the bad object and continue with the other objects in the list, or does it