2 ms·
If you have a tagged union type with Boolean literals as the tags, like in the slack api, then you can’t say ‘if not res.ok’ to narrow the type, you have to say
by emptysea 4y ago
If you have a tagged union type with Boolean literals as the tags, like in the slack api, then you can’t say ‘if not res.ok’ to narrow the type, you have to say ‘if res.ok == True’
Which isn’t very pythonic imho
Also I’m pretty sure ‘if res.ok is True’ doesn’t work