Apologies I'm not a core dev so this might be the wrong place to ask but I have 2 small clarifying questions about the PEP.
Firstly, if I have a library which supports multiple versions of Python and I need to catch all standard exceptions, what is considered the best practise after this PEP is introduced?
Currently I might have code like this right now:
try:
... # Code
except Exception as e:
... # Logic to handle exception
Reading through the PEP, particularly on backwards compatibility it looks like I would now need to do this:
try:
ExceptionGroup
except NameError:
standard_exceptions = Exception
else:
standard_exceptions
= (Exception, ExceptionGroup)
try:
... # Code
except
standard_exceptions
as e:
... # Logic to handle exception
Secondly, once I only support versions of Python that support Exception groups, what replaces the best practise for generally catching standard exceptions? Is it this:
try:
... # Code
except *Exception as e:
... # Logic to handle exception
Thanks,
Damian (He/Him)