[Python-bugs-list] [ python-Feature Requests-453506 ] lists should have a copy method
SourceForge.net
noreply@sourceforge.net
Tue, 21 Jan 2003 06:30:41 -0800
Feature Requests item #453506, was opened at 2001-08-20 23:23
You can respond by visiting:
https://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: Jesper Hertel (jhmagnus)
Date: 2003-01-21 15:30
Message:
Logged In: YES
user_id=592328
I agree that it would be nice (and consistent) if lists had
a copy() method. It would be more convenient. It is always
tiresome to have to import modules to do simple stuff like
this.
The list[:] is a trick that you have to know before you can
use it (it doesn't seem obvious to me), but list.copy()
seems intuitive to me.
----------------------------------------------------------------------
Comment By: Tim Peters (tim_one)
Date: 2002-04-23 07: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-23 05: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:
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=453506&group_id=5470