[Python-bugs-list] [ python-Feature Requests-453506 ] lists should have a copy method
SourceForge.net
noreply@sourceforge.net
Tue, 13 May 2003 06:34:34 -0700
Feature Requests item #453506, was opened at 2001-08-20 17:23
Message generated for change (Comment added) made by gvanrossum
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=453506&group_id=5470
Category: Python Interpreter Core
Group: None
>Status: Closed
>Resolution: Rejected
Priority: 1
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Guido van Rossum (gvanrossum)
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: Guido van Rossum (gvanrossum)
Date: 2003-05-13 09:34
Message:
Logged In: YES
user_id=6380
Intuitive, schmuitive. :-)
----------------------------------------------------------------------
Comment By: Tim Peters (tim_one)
Date: 2003-05-12 21:57
Message:
Logged In: YES
user_id=31435
Assigned to Guido for rejection <wink>.
----------------------------------------------------------------------
Comment By: Brett Cannon (bcannon)
Date: 2003-05-12 21:46
Message:
Logged In: YES
user_id=357491
I'm with Tim; you don't need seven ways to copy (Tim forgot using a list
comprehension and ``map(None, list)`` =).
I say this RFE gets rejected.
----------------------------------------------------------------------
Comment By: Jesper Hertel (jhmagnus)
Date: 2003-01-21 09: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 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:
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=453506&group_id=5470