Move around example in to_bytes() to avoid confusion (#101595)

Moves an example to be closer to the sentence that refers to it.
This commit is contained in:
Sergey B Kirpichev 2023-03-05 12:31:56 +03:00 committed by GitHub
parent a74cd3ba5d
commit 5da379ca7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -530,12 +530,14 @@ class`. In addition, it provides a few more methods:
is ``False``.
The default values can be used to conveniently turn an integer into a
single byte object. However, when using the default arguments, don't try
to convert a value greater than 255 or you'll get an :exc:`OverflowError`::
single byte object::
>>> (65).to_bytes()
b'A'
However, when using the default arguments, don't try
to convert a value greater than 255 or you'll get an :exc:`OverflowError`.
Equivalent to::
def to_bytes(n, length=1, byteorder='big', signed=False):