logoalt Hacker News

kstrauser12/10/20240 repliesview on HN

The result of the expression is not compared to an annotation if there isn't one, but that result absolutely has a type of its own.

And the objects inside an expression assuredly care about their types:

  >>> '1' + 1
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  TypeError: can only concatenate str (not "int") to str