>>> "abc" + 321
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: can only concatenate str (not "int") to str
I rest my case.I am not a Python expert, but...
Python is described as OO and I thought is is dynamically typed
Not quite "without any typing" but close
Strong versus weak is not super solidly defined as referring only to values and not variables.
Correct.
> Strong versus weak is not super solidly defined as referring only to values and not variables.
You're right. It's not super solidly defined as referring only to variables and not values, either. If dynamic typing is the same as weak typing, there'd be no point in having both phrases.
> Correct.
Is it still unclear with the clarification you didn't quote? I can't tell if I need to explain more or not.
> It's not super solidly defined as referring only to variables and not values, either.
I didn't mean to suggest it was.
> If dynamic typing is the same as weak typing, there'd be no point in having both phrases.
It's not the same. There's a bunch of things referred to as "weak".
I would call that weakly typed since there is no step before your code runs that validates (or even tries to validate) that your program satisfies a "type system". But since the definition of "strong" and "weak" typing has always been vague, I will just say that it is stupidly typed[1], and that I am a pedantic nerd.
1. https://danieltuveson.github.io/programming/languages/stupid...
Using both Python and mandatorily statically typed languages regularly professsionally (my main working languages being C#, Python, and a mix of JS and TS), that's not my experience at all.
(Of course, Python has a variety of optional static typecheckers with differing degrees of type inference, as well as supporting explicit type specifications; its not untyped unless you choose to use it that way.)
JS and TS are not good examples of typed languages.
I dunno about c#
I'm pretty competent in Python, C, Java, JavaScript, assembly, and a number of other languages†, and my experience in Python is nothing like what you're describing, although I do have my own frustrations with it. It's possible that when you're more experienced you'll have a different perspective, but it sounds like you're stuck inside a pretty small bubble right now.
______
† Last year I also programmed in C++, Lua, C#, bash, Tcl, Emacs Lisp, Forth, Golang, OCaml, Scheme, Perl, Common Lisp, and the ngspice scripting language.
Yea, nah!
You cannot have both.
Particularly, there is a common definition of “typed” which is exactly equivalent to “statically typed” under which all so-called “dynamically typed” languages are actually “untyped”, and within that system strong and weak typing are either a meaningless distinction or one within the set of statically types languages.
There's also, of course, a common usage within which “dynamically typed” is meaningful and strong vs. weak typing is a separate distinction, usually mostly discussed within languages with dynamic typing, though languages like C being both statically typed and weakly typed has been discussed.
I program in assembly language. Memory is just a big array of bytes. Values don't have types, but each instruction chooses what type to interpret memory as - e.g. uint8, int16, float32, x86 real-mode pointer, long-mode pointer, etc.
That would mean languages like Tcl. Or, for that matter, B.
[0] https://en.wikipedia.org/wiki/BCPL
[1] https://en.wikipedia.org/wiki/BLISS
[2] https://en.wikipedia.org/wiki/Forth_(programming_language)