This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pfalcon
Recipients pfalcon
Date 2014-04-08.13:32:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1396963926.18.0.0845457465299.issue21180@psf.upfronthosting.co.za>
In-reply-to
Content
With bytearray, you can do:

>>> bytearray(3)
bytearray(b'\x00\x00\x00')

However, with arrays:

>>> array.array('i', 3)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'int' object is not iterable

Given that int passed as seconf argument is not handled specially in array, I'd like to propose to make it an initial size of a zero-filled array to create. This will make it: a) consitent with bytearray; b) efficient for the scenarios where one needs to pre-create array of given length, pass to some (native) function to fill in, then do rest of processing. For the latter case, assuming that both fill-in and further processing is efficient (e.g. done by native function), the initial array creation becomes a bottleneck.
History
Date User Action Args
2014-04-08 13:32:06pfalconsetrecipients: + pfalcon
2014-04-08 13:32:06pfalconsetmessageid: <1396963926.18.0.0845457465299.issue21180@psf.upfronthosting.co.za>
2014-04-08 13:32:06pfalconlinkissue21180 messages
2014-04-08 13:32:05pfalconcreate