[issue45155] Add default arguments for int.to_bytes()

Vedran Čačić report at bugs.python.org
Fri Sep 10 01:35:02 EDT 2021


Vedran Čačić <vedgar at gmail.com> added the comment:

> choose one for the default so that default encoding/decoding will work cross platform.  I think "little" is the most common (intel and arm).

Raymond, please don't do this. We already have a "sensible default" in a network context, and it is big endian. Having another "sensible default" opposite to the previous one is really no way to ensure interoperability. (https://xkcd.com/927/ only becomes more ridiculous when the number in question is 2.:) I don't want to think about whether the way machines A and B exchange data can be called "a network" or not.

Of course, having the byteorder optional when there's only one (unsigned) byte is good.

----------
nosy: +veky

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45155>
_______________________________________


More information about the Python-bugs-list mailing list