[docs] [issue27622] int.to_bytes(): docstring is not precise

INADA Naoki report at bugs.python.org
Tue Jul 26 03:01:37 EDT 2016


INADA Naoki added the comment:

@mmarkk

Do you read full docstring?  It's documented very clearly.

---
int.to_bytes(length, byteorder, *, signed=False) -> bytes

Return an array of bytes representing an integer.

The integer is represented using length bytes.  An OverflowError is
raised if the integer is not representable with the given number of
bytes.

The byteorder argument determines the byte order used to represent the
integer.  If byteorder is 'big', the most significant byte is at the
beginning of the byte array.  If byteorder is 'little', the most
significant byte is at the end of the byte array.  To request the native
byte order of the host system, use `sys.byteorder' as the byte order value.

The signed keyword-only argument determines whether two's complement is
used to represent the integer.  If signed is False and a negative integer
is given, an OverflowError is raised.
---

----------

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


More information about the docs mailing list