Re:Python’s “type hints” are a bit of a disappointment to me
by int_19h on Friday April 22, 2022 @08:11PM
(#31129872)
The source code shouldn't need to say anything about the type of the resulting matrix explicitly, perhaps. But why shouldn't the type system keep track of shapes and deduce the accurate type for the result of said multiplication?
Re:Python’s “type hints” are a bit of a disappointment to me
by bayesian_horse on Saturday April 23, 2022 @12:25AM
(#31131385)
Because the shape can be dynamic, for example.
Significant types in ETL-style applications typically come from outside (e.g. a certain CSV column in the input file contains a date in YYYYMMDD format, or maybe YYYYDDMM, figure it out, and don't forget time zones or your accounting will go wrong).
Then types are mostly complex but obvious and easily deducted (e.g. multiplying matrices of compatible shapes necessarily gives a matrix of a certain shape, why should the program say anything more detailed or lower-level than "do a matrix multiplication" or "do a tensor product"?); they are an often dynamic and unpredictable property of the data, not a useful abstraction.