logoalt Hacker News

yodsanklai12/09/20243 repliesview on HN

> No types

It's pretty easy to add types to Python nowadays. I'd consider it bad practice not to do so in a large project.


Replies

seanmceligot12/09/2024

It would be nice if python would show types in the documentation. Not only do I need that all the time, it would show python was taking type safety serious.

For example, knowing the return type of a function is Union[DataFrame,Series] rather than simply DataFrame would save a lot of bad errors.

kccqzy12/09/2024

That's only true for greenfield projects where people start a new project with types in mind. It's absolutely a nightmare for old projects because, without the need to write types, people write all kinds of code that cannot fit within what's possible in python's type annotations.

show 1 reply
zellyn12/09/2024

Starlark, unfortunately, does not really support (Python style) types yet. Facebook's version has some kind of types, but ideally Starlark would just learn to do mypy types.