2 ms·
"Lack of type system". That is an absurd claim. Python is dynamic but strongly typed.
by greenshackle2 7y ago
"Lack of type system". That is an absurd claim. Python is dynamic but strongly typed.
- jefftk 7y agoPython also can now be optionally typed, which the article discusses. More: http://mypy-lang.org/ http://mypy-lang.org/
- greenshackle2 7y agoI'm sure you know this, but just to explain "optionally typed" a bit more, Python objects are always strongly typed (can't add a string and an int together like in JS, etc.), by default Python variables are not typed - a variable can refer to objects of different types at different times. Python 3 has introduced syntax to optionally declare types in the source (type annotations). This does not affect the runtime. Mypy is a program that does static analysis to tell you where your code is inconsistent with your type annotations, so: a: int = "foo" Will compile to bytecode and run fine, but if you run mypy it will warn you that you're not supposed to assign a string to a.