[Python-bugs-list] [ python-Bugs-686323 ] Minor array module enhancements

SourceForge.net noreply@sourceforge.net
Thu, 13 Feb 2003 17:13:46 -0800


Bugs item #686323, was opened at 2003-02-14 01:13
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=686323&group_id=5470

Category: Python Library
Group: Feature Request
Status: Open
Resolution: None
Priority: 5
Submitted By: paul rubin (phr)
Assigned to: Nobody/Anonymous (nobody)
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.

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=686323&group_id=5470