[issue8023] bug in s.append(x)

Mark Dickinson report at bugs.python.org
Fri Feb 26 12:13:37 CET 2010


Mark Dickinson <dickinsm at gmail.com> added the comment:

> So s.append(x) just copies the pointer, not the actual value.

Yes, that's a reasonable way to think about it (though the term 'reference' seems to more popular than 'pointer' in this context).  It matches the implementation, too: internally, a list is represented as a resizable array of pointers to objects.  (For CPython, anyway;  alternative implementations of Python might differ.)

Implicit object copies are rare in Python.

comp.lang.python is a good place to ask questions about Python's object model.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8023>
_______________________________________


More information about the Python-bugs-list mailing list