[Python-bugs-list] [ python-Feature Requests-453506 ] lists should have a copy method

noreply@sourceforge.net noreply@sourceforge.net
Mon, 22 Apr 2002 22:43:24 -0700


Feature Requests item #453506, was opened at 2001-08-20 17:23
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=355470&aid=453506&group_id=5470

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: lists should have a copy method

Initial Comment:
This is per someone on comp.os.python.
It's odd that dictionaries have a copy
method (you can say dict.copy()) but to
copy a list you have to say list[:] or use
copy.copy.  I think list.copy() should be added
for consistency.


----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2002-04-23 01:43

Message:
Logged In: YES 
user_id=31435

I doubt Guido would go for it.  dicts grew a .copy() method 
*because* there was no convenient syntax like list[:] that 
worked for dicts.  That's not a reason to add a .copy() 
method to lists too.  Note that if you're too fond of 
uniformity <wink>, don't use any of these:  use copy.copy() 
or copy.deepcopy().  Python doesn't need four ways to 
spell "copy this list".  Oops:  make that five.  list
(somelist) also copies a list.  In 2.2, dict(somedict) also 
copies a dict.  Enough already.

----------------------------------------------------------------------

Comment By: Michael Gilfix (mgilfix)
Date: 2002-04-22 23:53

Message:
Logged In: YES 
user_id=116038

What's the status of this? It seems pretty useful. I could
submit a patch if someone likes...

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=355470&aid=453506&group_id=5470