Ivan Illarionov wrote: > And even faster: > a = array.array('i', '\0' + '\0'.join((s[i:i+3] for i in xrange(0, > len(s), 3)))) > if sys.byteorder == 'little': > a.byteswap() > > I think it's a fastest possible implementation in pure python
Clever, but note that it doesn't work correctly for negative numbers. For those you'd have to prepend "\xff" instead of "\0". Peter -- http://mail.python.org/mailman/listinfo/python-list