3 ms·
Unlike JavaScript however, Python is strongly typed.
by anticensor 5y ago
Unlike JavaScript however, Python is strongly typed.
- IshKebab 5y agoPython's type system is not more strongly typed than JavaScript's in any way that makes it easier to optimise.
- Spivak 5y agoYeah but in practice basically all JS code in the wild is strongly typed since the community has long since decided that relying on implicit type coercion is a massive footgun. Also I think Python’s truthy/falsey semantics make it dangerously close to being weakly typed.
- staticassertion 5y agoAll that means is that you get more exceptions raised when you use ==. It doesn't help performance at all, it doesn't even really confer anything about types, only that __eq__ is implemented between fewer types.
- anticensor 5y agoPython exceptions are low-cost. It has to be that way because every for loop in Python throws an exception.