

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
2 messages in org.python.python-bugs-list[ python-Feature Requests-686323 ] Mi...| From | Sent On | Attachments |
|---|---|---|
| SourceForge.net | Mar 13, 2004 5:59 pm | |
| SourceForge.net | Mar 14, 2004 12:53 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | [ python-Feature Requests-686323 ] Minor array module enhancements | Actions... |
|---|---|---|
| From: | SourceForge.net (nore...@sourceforge.net) | |
| Date: | Mar 13, 2004 5:59:55 pm | |
| List: | org.python.python-bugs-list | |
Feature Requests item #686323, was opened at 2003-02-13 20:13 Message generated for change (Settings changed) made by rhettinger You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=355470&aid=686323&group_id=5470
Category: Extension Modules Group: None Status: Open Resolution: Later Priority: 4 Submitted By: paul rubin (phr)
Assigned to: Raymond Hettinger (rhettinger)
Summary: Minor array module enhancements
Initial Comment: 1) I notice that array('B', (2,3,4)) throws an error saying the 2nd arg must be a list or string. That is, array('B', [2,3,4]) is legal but using the tuple (2,3,4) is not. The limitation doesn't seem harmful, but I also don't see any good reason for it. May as well remove it.
2) Of more usefulness (and maybe of more controversy), I think the byte array methods should accept string arguments, for example a = array('B', 'abc') a.append('def') should do the obvious thing. That gives a natural way to build up a string in pieces instead of making a list of strings and doing the counterintuitive ''.join(x) maneuver. Appending to byte arrays is the usual way to build up a string in Java, if that matters. So I favor this change too.
----------------------------------------------------------------------
Comment By: Raymond Hettinger (rhettinger) Date: 2003-04-24 05:48
Message: Logged In: YES user_id=80475
Added the first request as arraymodule.c 2.88
I'm passing on the second request for now. Auto-promoting the argument entails attempting to construct a new array object of the same type as that being extended. That is a bit cumbersome but doable. It also requires that any array creation errors be trapped and re-explained the context of array.extend().
----------------------------------------------------------------------
Comment By: paul rubin (phr) Date: 2003-02-13 23:42
Message: Logged In: YES user_id=72053
You're correct, second request should be for extend rather than append.
That is,
a = array('B', 'abc') a.extend('def')
should do the obvious thing.
----------------------------------------------------------------------
Comment By: Raymond Hettinger (rhettinger) Date: 2003-02-13 23:34
Message: Logged In: YES user_id=80475
The first request is reasonable.
The second is not the natural meaning of append(). In python, multiple appends are handled with extend(). The array module already provides extend. So, for the example given above, the code is:
a = array('B', 'abc') a.extend(array('B', 'def')) a
array('B', [97, 98, 99, 100, 101, 102])
----------------------------------------------------------------------
You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=355470&aid=686323&group_id=5470







