4 ms·
> I think we should be teaching static types and I pushed for Typescript Another option would be to introduce Python types: def square(x: int) -> int:
by jefftk 5y ago
> I think we should be teaching static types and I pushed for Typescript
Another option would be to introduce Python types:
def square(x: int) -> int:
return x*x
http://mypy-lang.org/examples.html http://mypy-lang.org/examples.html
- benrbray 5y agoIs there something like DefinitelyTyped for Python? TypeScript only became useful once the ecosystem reached a critical mass of type definitions available for popular libraries. At the moment the Python community seems pretty anti-static-types, and the core scientific libraries (numpy, matplotlib, pytorch) don't export type signatures. Language server / intellisense support for type inference also has a long way to go.
- vorticalbox 5y agoNot that I am aware of. You can create you own types like what has happened with boto3 [1] I would assume as types become used more a definitely typed type project will happen on pypi. [1] https://pypi.org/project/boto3-type-annotations/ https://pypi.org/project/boto3-type-annotations/