7
There is some confusion about the concept of programming languages with static and dynamic typing and the concept of strongly and weakly typed programming languages.
For example, in my opinion Python
is a language with dynamic typing as I can assign any value to a variable (x
in the example):
>>> x = 1
>>> x = "teste"
>>>
However, Python
is also a strongly typed language because I can’t do something like:
>>> x = "0"
>>> x += 1
Traceback <most recent call last>:
File "<stdin>", line 1, in <module>
TypeError: Can't covert 'int' object to str implicitly
Could someone explain it to me better?
Related: What is the difference between a static and dynamic programming language?
– rray
I think we can consider duplicate. Leo Ribeiro, the answer on this link clarifies your doubt?
– bfavaretto
I don’t think @bfavaretto, because the link’s own answer says: The definition of these terms does not help much and to say that a language is weakly or strongly typed uniquely is also not usually true.
– Leo Ribeiro
But isn’t that just the answer? What’s missing there to clear up your doubt?
– bfavaretto
@Leoribeiro I consider duplicate. Or it is not clear what you want. There is all the information that I think is necessary to clarify the topic. If you have something more specific that still has doubt, be specific in the question. The answer says this because this is it. Things are not black and white. Languages are not pure. Time it can behave one way, time another.
– Maniero
I understand, gentlemen. I believe you can withdraw then.
– Leo Ribeiro
We don’t erase duplicates, we just put this sign up pointing to another question. Duplicates are seen as alternative ways to get answers. Keeping duplicates means giving people more chance to find the answers they need via search engines. Oh, and welcome to the site! :)
– bfavaretto
I could even answer here and get more dots, but I’d practically copy a part of what’s there :)
– Maniero