Hacker News new | past | comments | ask | show | jobs | submit login

I'm very satisfied with the new typing [0][1] module. It's part of the standard library since Python 3.5 and it provides type annotations similar to those of Typescript. It's still missing some features (IMO), but it's also under active development, so I guess more useful features will come.

  from typing import List

  Vector = List[float]

  def scale(scalar: float, vector: Vector) -> Vector:
      return [scalar * num for num in vector]

  def greeting(name: str) -> str:
      return 'Hello ' + name

[0] https://github.com/python/typing [1] https://docs.python.org/3/library/typing.html



Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: