News for hackers. Stuff that matters.
Re:State of Python 3.13 Performance: Free-Threading by almostgotcaught on Thursday November 07, 2024 @11:48AM (#42078330)
> If I write `def foo(x):` versus `def foo(x: int) -> float:`, one is a restricted subset of the other, but both are the language's "real" semantics.

You either are performing some wordplay here or you don't understand but type hints are not part of the semantics at all: since they are not processed at all they do not affect the behavior of the function (that's what semantics means).

EDIT: according to the language spec and current implementation

`def foo(x: int) -> float`

and

`def foo(x: float) -> int`

are the same exact function

Re:State of Python 3.13 Performance: Free-Threading by movpasd on Sunday November 10, 2024 @03:17PM (#42102355)
That's not strictly true -- type annotations are accessible at runtime (that's how things like dataclasses and pydantic work).