mark-todd
(Mark Todd)
49
The below is similar to the point stated in the in-line type hints discussion, but I’m copying here in case it’s useful to people:
boolif
would be equivalent to this, without the need to add additional functions:
from typing import assert_type as at
if at(foo, bool):
print('here')
The only issue here as I mention in the other post is brevity, although this syntax can be made pretty brief.