From: Sergey B Kirpichev Date: Sun, 5 Mar 2023 09:31:56 +0000 (+0300) Subject: Move around example in to_bytes() to avoid confusion (#101595) X-Git-Tag: v3.12.0a6~21 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5da379ca7dff44b321450800252be01041b3320b;p=thirdparty%2FPython%2Fcpython.git Move around example in to_bytes() to avoid confusion (#101595) Moves an example to be closer to the sentence that refers to it. --- diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 1240f80b0f11..550f808a16df 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -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):