
May 19, 2022
12:06 a.m.
19.05.22 09:45, nadav.misgav@gmail.com пише:
Awesome! never seen this syntax used before and the above libraries are not using it.
Can you elaborate on the else part ? Why is it needed for the syntax to be correct and could you put any expression in the parenthesis ?
https://docs.python.org/3/reference/expressions.html#conditional-expressions The tricky part is that isinstance(obj, ()) and issubclass(cls, ()), and corresponding internal check used in the `except ()` clause always return False. It is not explicitly stated (unlike to all() and any()), but it follows from the description if you read it carefully.