Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

17
  • Won't that use the system native endianness though? Commented Dec 5, 2010 at 11:47
  • 1
    @Karl: No, it won't. The fourth parameter to PyLong_AsByteArray() indicates which endianness to use: 0 means big endian, anything else means little endian. Commented Dec 5, 2010 at 11:52
  • Awesome. Now I wish this were exposed directly... :/ Commented Dec 5, 2010 at 12:13
  • Has this API changed much over different versions of Python? Commented Dec 5, 2010 at 16:58
  • 2
    int(binascii.hexlify(stringbytes), 16) is faster than ctypes.pythonapi._PyLong_FromByteArray. Whoulda thunk it? Commented Feb 12, 2011 at 15:10