
Aug. 10, 2009
10:05 a.m.
On Sat, Aug 8, 2009 at 10:31 PM, Guido van Rossum<guido@python.org> wrote:
[...] I'd be okay with a standard API to transform a byte array into an integer and vice versa -- there you can be explicit about byte order and what to do about negative numbers. [...]
That would also be a welcome addition. It's been requested on bugs.python.org at least a couple of times[1][2], and the C code to do the conversions already exists (_PyLong_{As,From}_ByteArray in longobject.c), so it wouldn't be too much work to implement. The main problem would be deciding exactly what the API should be and where to put it. Mark [1] http://bugs.python.org/issue1023290 [2] http://bugs.python.org/issue923643