Change History (7)

I couldn't think of a better way to the full compatibility, unfortunately. We're going to need this if we ever do %s support, but it's easy enough to drop as YAGNI. If we do drop it, we should probably make this API private, since it's easy to get it wrong if you use it for anything other than integers.

Using memoryview for this seems like a bad idea. Exactly three types are supported (exactly three types are unit tested). Wandering into the "buffer API" realm is just asking for trouble. All we really need is a function for getting a bytes-representation of a few very simple types. Who knows what dragging memoryview into the picture is going to do? Let's implement and advertise this as a very simple function of limited capabilities. If it really turns out to be necessary, we can expand that simple functionality later.

intToBytes, listToBytes might be an alternative approach that suggests different (slightly better) names.