No, again you're thinking of "static", not "strong".
Strong versus weak is historically poorly defined, and there's no single universally-accepted definition, but you can get the gist of it from considering the following:
a = '1'
b = 2
c = a + b
In JavaScript, the above code results in the name 'c' being bound to the string value '12'. In Python, the above code raises TypeError. Generally, "weak" typing refers to the idea that the language may coerce the values of operands to other types in order to make an operation succeed (in the above, JavaScript coerced the value of 'b' to a string and interpreted the '+' operator as asking for string concatenation, hence the result is the string '12'). "Strong" typing generally means the language won't do that, and will error out on you if you attempt an operation on values of incompatible types.
"Static" versus "dynamic" typing is a completely different set of terms. There's also some debate over definitions, but broadly, consider the following expression:
a = 1
In a statically-typed language, both the name 'a' and the value 1 have types, and in order to bind names to values their types must be compatible. So in the above, it's likely that both 'a' and 1 are of type int, so the assignment expression would be legal. Later attempting to bind 'a' to a value of a type incompatible with int (say, 'a = "foo"') would fail. Statically-typed languages also come with an expectation that all expressions can be checked for compatible types without needing to execute the code, and that a tool will exist to do this checking for you.
In a dynamically-typed language, however, only values have types; names do not, so binding a name to a value of a particular type does not foreclose later re-binding to a value of a different type (i.e., the name 'a' might be bound to an int now, and get re-bound to a string later). This means there will be cases in a dynamically typed language where the only way to verify correctness of an expression is to execute the code (though you can usually check a high percentage without running the code).
ubernostrum|7 years ago
Strong versus weak is historically poorly defined, and there's no single universally-accepted definition, but you can get the gist of it from considering the following:
In JavaScript, the above code results in the name 'c' being bound to the string value '12'. In Python, the above code raises TypeError. Generally, "weak" typing refers to the idea that the language may coerce the values of operands to other types in order to make an operation succeed (in the above, JavaScript coerced the value of 'b' to a string and interpreted the '+' operator as asking for string concatenation, hence the result is the string '12'). "Strong" typing generally means the language won't do that, and will error out on you if you attempt an operation on values of incompatible types."Static" versus "dynamic" typing is a completely different set of terms. There's also some debate over definitions, but broadly, consider the following expression:
In a statically-typed language, both the name 'a' and the value 1 have types, and in order to bind names to values their types must be compatible. So in the above, it's likely that both 'a' and 1 are of type int, so the assignment expression would be legal. Later attempting to bind 'a' to a value of a type incompatible with int (say, 'a = "foo"') would fail. Statically-typed languages also come with an expectation that all expressions can be checked for compatible types without needing to execute the code, and that a tool will exist to do this checking for you.In a dynamically-typed language, however, only values have types; names do not, so binding a name to a value of a particular type does not foreclose later re-binding to a value of a different type (i.e., the name 'a' might be bound to an int now, and get re-bound to a string later). This means there will be cases in a dynamically typed language where the only way to verify correctness of an expression is to execute the code (though you can usually check a high percentage without running the code).
Python is strongly typed and dynamically typed.