Issue 721061: Add copyrange method to array. (original) (raw)

This issue has been migrated to GitHub: https://github.com/python/cpython/issues/38300

classification

Title: Add copyrange method to array.
Type: enhancement Stage:
Components: Extension Modules Versions:

process

Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: nyamatongwe, rhettinger
Priority: normal Keywords:

Created on 2003-04-14 12:41 by nyamatongwe, last changed 2022-04-10 16:08 by admin. This issue is now closed.

Messages (5)
msg53849 - (view) Author: Neil Hodgson (nyamatongwe) Date: 2003-04-14 12:41
The split buffer data structure commonly used in text editors to efficiently manipulate text and data attached to that text can be implemented using the Python array type with the addition of a way to rapidly copy data within arrays. There may be other situations in which rapidly copying blocks within an array is useful. -- Neil Hodgson
msg53850 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-05-22 07:44
Logged In: YES user_id=80475 Moving to feature requests.
msg53851 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2004-03-13 21:44
Logged In: YES user_id=80475 How does this differ from slice semantics?
msg53852 - (view) Author: Neil Hodgson (nyamatongwe) Date: 2004-03-13 22:46
Logged In: YES user_id=12579 If you are asking how the copyrange differs from a sliced copy like >>> import array >>> a = array.array("c", "0123456789") >>> a array('c', '0123456789') >>> a[5:8] = a[0:3] >>> a array('c', '0123401289') There is an extra object creation and copy for the temporary slice. I think the actual copy between slices of the same type is fast. Possibly the original patch was lost so it can be found at http://scintilla.sourceforge.net/arraycopyrange.diff I didn't chase this much before as it may be better for me to produce a 'text' class that combines more features into an efficient mutable document type.
msg53853 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2004-03-14 06:03
Logged In: YES user_id=80475 The 'text' class is likely the way to go. I see your point about the extra object creation. However, given that there is currently a way (not a good) to do it, does the use case warrant the addition of non general purpose method. I don't think so; even lists don't have copyrange(). Am closing this request. If you change your mind and decide that this is an essential addition, feel free to re-open it.
History
Date User Action Args
2022-04-10 16:08:08 admin set github: 38300
2003-04-14 12:41:24 nyamatongwe create