Another #mypy puzzler; apparently mypy doesn’t know how to do type narrowing when you do an early return like this:
mypy
https://mypy-play.net/?mypy=latest&python=3.10&gist=29a4ee0232bf69953ec79680eb39f550
#python
@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.
@kevinbrownsilva Ah, good point!
QOTO: Question Others to Teach Ourselves An inclusive, Academic Freedom, instance All cultures welcome. Hate speech and harassment strictly forbidden.