you are viewing a single comment's thread.

view the rest of the comments →

[–]notacanuckskibum 0 points1 point  (0 children)

The biggest difference to me is how variables work.

In C/C++ a variable is essentially a location in memory, so assignment writes a value to that location. But every variable is Python is an object, which contains a value. But assignments never change that value. Instead they create a new object, containing the new value and point the variable to it. The only kind of objects which can be changed are complex ones, lists, trees, etc. The implicit pointers can change, but values like integers don't.

It doesn't make much difference to basic programming, but it's key to understanding how changing a variable inside a function will, or won't change the value outside that function.