On Jul 20, 2011, at 3:02 PM, Antoine Pitrou wrote:
Is there a reason why there the array.array constructor does not allow to simply specify the number of items that should be allocated? (I do not really care about the contents.) Would this be a worthwhile addition to / modification of the array module?
I think it would be. Rather than an additional constructor parameter, perhaps it could be a separate method (like we already have extend(), fromfile(), etc.).
+1, Jython's had a custom function for this forever, originally from its old jarray module: jarray.zeros(length, typecode). I think its swapped order of args are due to jarray probably predating the array module.
-- Philip Jenvey