3 ms·
> "static typing only catches trivial errors", That's partly because we tend to use the same types for everything. For instance in a spreadsheet you can subtra
by kwhitefoot 10y ago
> "static typing only catches trivial errors",
That's partly because we tend to use the same types for everything. For instance in a spreadsheet you can subtract a column number from a row number and get no complaints even though the difference between the two quite likely makes no sense. If you have a separate type for row numbers and column numbers such mistakes can be caught.
- throwawayish 10y agoIn your example you'd just have two different types with no subtraction operation defined between them. That has nothing to do with type hints. What you probably meant: This is where being strongly typed helps. Python is and always has been strongly typed.