Hacker News new | ask | show | jobs
by LeifCarrotson 1847 days ago
Python isn't strongly typed. You got an integer floor operation with -3 / 2 = -2, but -3.2 / 2 = -1.6. This led to errors when floats were expected but integers were possible among your inputs.

In Python 3, it always gives a floating-point result. You can use a floor division operator if you want to round everything (including integers) towards negative infinity.

See https://www.python.org/dev/peps/pep-0238/ for details.

1 comments

Python is strongly typed, and your examples show the strong (dynamic) type system in action. An example of a language that is not strongly typed would be Javascript, where you can do 1 + "1". In Python, that gets you a typeerror, because Python is strongly typed.
Sorry, you're right, it's strongly typed but it is not statically typed.