Re: The “does Python have variables?” debate

Chris Angelico rosuav at gmail.com
Thu May 8 04:14:48 EDT 2014


On Thu, May 8, 2014 at 6:07 PM, Joseph Martinot-Lagarde
<joseph.martinot-lagarde at m4x.org> wrote:
> For me, names bound to values is the same concept as pointer pointing to
> memory. bar = foo copies the pointer and not the underlying memory. This is
> not a foreign concept to C programmers.
>

That is how it's implemented in CPython, after all... modulo the whole
refcounting thing, of course. But that's not strictly a part of the
definition of Python; it's just implementation. You could implement
Python on pencil-and-paper (aka a dry run), and as long as you have a
concept of names that reference objects, it's going to be fine. The
"reference" might be done with a physical piece of string connecting a
Post-It note with a name to a box with the object's state, meaning
there's no way of copying any pointer, and it's still Python.

ChrisA



More information about the Python-list mailing list