Objects in Python
Evan Driscoll
driscoll at cs.wisc.edu
Sun Aug 26 01:25:06 EDT 2012
On 08/24/2012 10:04 PM, Steven D'Aprano wrote:
> The fact that the end result is the same is hardly surprising -- Python's
> VM is built on top of C pointer indirection, so of course you can start
> with pointers and end up with Python semantics. But the practice of
> coding are very different:
>
> * in C, I care about identifiers ("names") in order to explicitly manage
> addresses and pointers as a means to reach the data I actually care about;
>
> * in Python, I care about identifiers in order to reach the data I
> actually care about.
>
So I find this comment very interesting. It makes me wonder if the root
cause of our (pretty minor) disagreement is in some sense related to our
mental models of *C* variables. I'm actually not much of a C programmer
specifically, but I do a lot of C++ stuff. Of those two descriptions,
I'd actually say that the Python description sounds more like how I
think about variables in C++ most of the time.
Obviously there are differences between value and reference semantics
between the two languages, but thinking about some variable being
located at some address in memory is something that I actually do pretty
rarely; I basically think of variables as naming data, and addresses
mostly come into play when thinking about points-to and aliasing
information at a more abstract level, much the same as I do in Python.
Evan
More information about the Python-list
mailing list