4 ms·
> They pass by pointer-value. No, Python doesn't even do that, because Python variables aren't names for storage locations to begin with. They're namespace bin
by pdonis 8y ago
> They pass by pointer-value.
No, Python doesn't even do that, because Python variables aren't names for storage locations to begin with. They're namespace bindings. Passing a variable to a Python function means transferring a namespace binding from the caller's namespace to the function's local namespace.
- arduinomancer 8y agoWhat is a namespace binding? Can you explain at a low level what that means?
- pdonis 8y agoCompare a variable assignment in C and Python. In C: int i = 17; Means "set aside one int's worth of storage and fill it with the bit pattern for the number 17". In Python: i = 17 means "create an int object with the value 17 and bind it in the current namespace dictionary to the name i".
- colanderman 8y agoThe semantics are identical.
- pdonis 8y agoIf you think this, I'm confused about what you mean by "semantics".