Hacker News new | ask | show | jobs
by ubernostrum 3798 days ago
Also, Python is getting header files (called "stub" files), like C. In most modern languages, such as Go and Rust, that's all handled automatically by storing type info in the object files. But in future Python, that will be manual.

Stub files are not mandatory; type annotations can be in the same file as the code. This is perfectly legal, for example:

    def add(first_value: int, second_value: int) -> int:
        return first_value + second_value
Stub files exist because the syntax support didn't exist in earlier versions of Python, so if you write a library that supports older versions of Python you ship a stub file rather than causing syntax errors for a subset of your users.