[issue10516] Add list.clear() and list.copy()

Eli Bendersky report at bugs.python.org
Mon Dec 6 05:30:21 CET 2010


Eli Bendersky <eliben at gmail.com> added the comment:

Boštjan,

"a shallow copy": I took this directly from the documentation of dicts, which says:

   "D.copy() -> a shallow copy of D")

As I mentioned in an earlier message, the doc-strings of list and dict methods are inconsistent in more than one way, so I'm going to leave this decision to the committer. I'll be happy to help with fixes too.

Re your other question, in the Python source root, dictionaries are mostly implemented in Objects/dictobject.c - there's an array called mapp_methods that lists the functions used to implement relevant methods. For copy() it lists:

    {"copy",            (PyCFunction)dict_copy,         METH_NOARGS,

So you need dict_copy. Note that it's just a wrapper (of another wrapper, by the way) bit it's a good place to start. Arm yourself with an editor or IDE with some code-searching capabilities.

----------

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


More information about the Python-bugs-list mailing list