Is there a way to define names for multiple exceptions by using the as keyword or the python 2.5 grammar Exception, e? So if you define an try/except clause with exceptions in a tuple like this ...except (RuntimeError, TypeError, NameError): to also assign names to the errors e.g. like as (Rerr,Terr,Nerr)?
Or do I have to define them separately one by one?
try:
....
except RuntimeError as Rerr:
....
except TypeError as Terr:
....
....
But if you need them each named separately, then you’re presumably defining separate handler logic for each, in which case what is wrong with the separate definitions?
You can assign a single name to the exception regardless of type: