-
Notifications
You must be signed in to change notification settings - Fork 47
Closed
Labels
Description
We have a primitive for dict.copy but not list.copy, even though both operations are supported:
>>> [1, 3].copy()
[1, 3]The implementation would be a C function with similar structure to CPyDict_Copy. A shallow copy can be made using PyList_GetSlice(list, 0, PyList_GET_SIZE(list)). If the object type is not exactly list (i.e. it's an instance of a subclass), use a generic call to copy(), since it might return an instance of the subclass.