Hacker News new | ask | show | jobs
by denisrosset 1547 days ago
I'm starting to add type annotations to numerical code, and I wonder how to handle the disconnect between `float` (which is how floating-point literals are typed) and concrete NumPy types such as `numpy.float64` (which is the scalar type I get out of NumPy arrays).

I ended up defining an alias:

Float = Union[float, numpy.float64]

but I wonder if there is a more legitimate way to handle thiss.