Maxim Khitrov wrote:
On Thu, Feb 19, 2009 at 2:35 PM, Robert Kern <robert.k...@gmail.com> wrote:
I have, but numpy is not currently available for python 2.6, which is
what I need for some other features, and I'm trying to keep the
dependencies down in any case....
The only feature that I'm missing with array.array is the ability to
quickly pre-allocate large chunks of memory. To do that right now I'm
using array('d', (0,) * size). It would be nice if array accepted an
int as the second argument indicating how much memory to allocate and
initialize to 0.

In the meantime, you could write a function (to ease the shift to numpy)
and reduce your interface problem to a very small set of lines:
    def zeroes_d(n):
        '''Allocate a n-element vector of 'd' elements'''
        vector = array.array('d') # fromstring has no performance bug
        vector.fromstring(n * 8 * '\0')
        return vector
Once numpy is up and running on 2.6, this should be easy to convert
to a call to zeroes.

--Scott David Daniels
scott.dani...@acm.org
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to