[ python-Feature Requests-992967 ] array.array objects should support sequences

SourceForge.net noreply at sourceforge.net
Sat Jul 17 20:30:09 CEST 2004


Feature Requests item #992967, was opened at 2004-07-17 14:30
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=992967&group_id=5470

Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Bob Ippolito (etrepum)
Assigned to: Nobody/Anonymous (nobody)
Summary: array.array objects should support sequences

Initial Comment:
array objects from the array module have an extend method that 
only takes arrays.  The implementation would be more useful if it 
accepted arbitrary sequences (generators, lists, strings, etc).  
Similarly, the initializer currently only accepts lists and strings, 
but it should also support arbitrary sequences.

>>> from array import array
>>> array('c', iter('1234'))
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: array initializer must be list or string
>>> array('c').extend('1234')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: can only extend array with array (not "str")

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

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


More information about the Python-bugs-list mailing list