Follow

Another puzzler; apparently mypy doesn’t know how to do type narrowing when you do an early return like this:

mypy-play.net/?mypy=latest&pyt

@pganssle I wonder if that has to do with subclasses? Like if you extended str in a class FancyStr and passed that in, your function is expecting FancyStr to be returned back. But you're only returning str, not FancyStr.

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.