Python extension - construct and inspect large integers efficiently
问题 I have a native library for which a natural interface would involve passing potentially large numbers. I anticipate about half being < 32 bits; another quarter < 64 bits; the next eighth < 128 bits - and so on, without a fixed length limit. PyLong_FromUnsignedLongLong() and PyLong_AsUnsignedLongLong() would be suitable if I could constrain values to fit in a single register. PyLong_FromString() overcomes this - but at the undesirable expense of requiring an intermediate representation.