[Python-ideas] Direct byte<->int conversions (was Re: bitwise operations on bytes)

Mark Dickinson dickinsm at gmail.com
Sat Aug 15 20:42:23 CEST 2009


On Sat, Aug 15, 2009 at 5:48 PM, Alexandre
Vassalotti<alexandre at peadrop.com> wrote:
> On Sat, Aug 15, 2009 at 12:25 PM, Mark Dickinson<dickinsm at gmail.com> wrote:
>> You say that the 'primary purpose of the API is long serialization'.
>> I'd argue that that's not quite true.
>
> And you are totally right. [...]

Eh?  But I came here for an argument!  Isn't this room 12?

A couple of other things:

If these additions to int go in, then presumably the _PyLong_AsBytes
and _PyLong_FromBytes functions should be documented and made public
(and have their leading underscores removed, too).  Those functions have
been stable for a good while, and are well-used within the Python source;
I think they're robust enough for public consumption.  There may be
some additional argument validation required;  I'll take a look at this.

In the issue tracker, Josiah Carlson asked about the possibility of
backporting to 2.7.  I can't see any problem with this, though there
would be some small extra work involved in making things work
for int as well as long.  Does anyone else see any issues with this?

Mark



More information about the Python-ideas mailing list