Maxim Khitrov wrote:
... Here's the function that I'll be using from now on. It gives me
exactly the behavior I need, with an int initializer being treated as
array size. Still not as efficient as it could be if supported
natively by array (one malloc instead of two + memmove + extra
function call), but very good performance nevertheless:

from array import array as _array
array_null = dict((tc, '\0' * _array(tc).itemsize) for tc in 'cbBuhHiIlLfd')
How about:
array_null = dict((tc, _array(tc, (0,)).tostring() for tc in 'cbBuhHiIlLfd')
...
(some ancient floating points did not use all-0 bytes for 0.0).

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

Reply via email to