Skip to content

Commit caff048

Browse files
[3.11] Move around example in to_bytes() to avoid confusion (GH-101595) (#102434)
Move around example in to_bytes() to avoid confusion (GH-101595) Moves an example to be closer to the sentence that refers to it. (cherry picked from commit 5da379c) Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
1 parent f96907a commit caff048

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Doc/library/stdtypes.rst

+4-2
Original file line numberDiff line numberDiff line change
@@ -530,12 +530,14 @@ class`. In addition, it provides a few more methods:
530530
is ``False``.
531531

532532
The default values can be used to conveniently turn an integer into a
533-
single byte object. However, when using the default arguments, don't try
534-
to convert a value greater than 255 or you'll get an :exc:`OverflowError`::
533+
single byte object::
535534

536535
>>> (65).to_bytes()
537536
b'A'
538537

538+
However, when using the default arguments, don't try
539+
to convert a value greater than 255 or you'll get an :exc:`OverflowError`.
540+
539541
Equivalent to::
540542

541543
def to_bytes(n, length=1, byteorder='big', signed=False):

0 commit comments

Comments
 (0)