[issue27637] int.to_bytes(-1, ...) should automatically choose required count of bytes

Serhiy Storchaka report at bugs.python.org
Thu Jul 28 02:14:51 EDT 2016


Serhiy Storchaka added the comment:

This is rarely needed, mainly in general serializers like pickle. The code for determining the minimal number of bytes is not trivial, but it depends on the serializer. If you always serialize unsigned values and saves the sign separately, or use one's complement represenatation, or if the serializer supports only fixed set of integer sizes, the code is absolutely different.

I don't think that we need this feature in the stdlib.

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27637>
_______________________________________


More information about the Python-bugs-list mailing list