News for hackers. Stuff that matters.
Re:Responder: A familiar HTTP Service Framework by akubera on Wednesday October 17, 2018 @02:12AM (#18236518)
If you use isinstance(x, (int, float)) instead of type(x) == int then I think you'll find your expected behavior.

When you say type narrowing do you mean floats should be automatically interpreted as int? There is typing.{SupportsInt, SupportsFloat} which can be considered "number" base classes which you may consider as type narrowing. Otherwise if you mean "type of x is known in this if-block" you do get that with `isinstance` type checks (which is the preferred, pythonic way).

I agree that mypy should warn if a NoReturn is assigned; apparently it just ignores typechecking below the NoReturn function call, and is really only used to ensure the NoReturn function is guaranteed to raise before it returns.

Re:Responder: A familiar HTTP Service Framework by jakear on Wednesday October 17, 2018 @02:37AM (#18236656)
`isinstance` is what I wanted for narrowing, thanks!