[Python-Dev] PEP 572, VF/B, and "Shark Jumping"
Steven D'Aprano
steve at pearwood.info
Thu Jul 5 14:21:30 EDT 2018
On Thu, Jul 05, 2018 at 08:52:24PM +0300, Ivan Pozdeev via Python-Dev wrote:
> * Same goes for `except`: doesn't accept expressions, same semantic.
py> def make_exception(arg):
... return ValueError if arg else TypeError
...
py> expr = [make_exception]
py> try:
... 1+"1"
... except expr[0](None) as err:
... print("caught", type(err))
... print(err)
...
caught <class 'TypeError'>
unsupported operand type(s) for +: 'int' and 'str'
--
Steve
More information about the Python-Dev
mailing list