DEV Community

Discussion on: Python for JavaScript Developers

Collapse
 
bmarkovic profile image
Bojan Markovic

Yes, this is the most important distinction. This also frustrates many people coming from languages other than PHP to JavaScript.

Namely, both JavaScript and PHP are not just dynamically typed, but also loosely typed in the sense that values are implicitly casted if it's possible, to match the type expected by function call or operator. Furthermore, in JavaScript there are very odd implicit casting rules that cast operands based on combination of the other operand and operator that aren't always intuitive (the + operator when either operand is a string comes to mind).

Python on the other hand is duck typed, which is a term invented to differentiate it's specific brand of dynamic typing that is not quite strong typing (as it doesn't require explicit interface adherence declaration), but not quite loose typing either (as it doesn't implicitly cast, i.e. it's behavior is more similar to that of, say, Ruby in this regard, than to that of JS or PHP).