Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7cefc30

Browse files
committed
Tighten up 'byte string' wording in base64 docs.
1 parent a90032a commit 7cefc30

1 file changed

Lines changed: 22 additions & 20 deletions

File tree

Doc/library/base64.rst

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,23 @@
1010
single: MIME; base64 encoding
1111

1212
This module provides data encoding and decoding as specified in :rfc:`3548`.
13-
This standard defines the Base16, Base32, and Base64 algorithms for encoding and
14-
decoding arbitrary binary strings into text strings that can be safely sent by
15-
email, used as parts of URLs, or included as part of an HTTP POST request. The
16-
encoding algorithm is not the same as the :program:`uuencode` program.
17-
18-
There are two interfaces provided by this module. The modern interface supports
19-
encoding and decoding string objects using all three alphabets. The legacy
20-
interface provides for encoding and decoding to and from file-like objects as
21-
well as strings, but only using the Base64 standard alphabet.
13+
This standard defines the Base16, Base32, and Base64 algorithms for encoding
14+
and decoding arbitrary binary strings into ASCII-only byte strings that can be
15+
safely sent by email, used as parts of URLs, or included as part of an HTTP
16+
POST request. The encoding algorithm is not the same as the
17+
:program:`uuencode` program.
18+
19+
There are two interfaces provided by this module. The modern interface
20+
supports encoding and decoding ASCII byte string objects using all three
21+
alphabets. The legacy interface provides for encoding and decoding to and from
22+
file-like objects as well as byte strings, but only using the Base64 standard
23+
alphabet.
2224

2325
The modern interface provides:
2426

2527
.. function:: b64encode(s, altchars=None)
2628

27-
Encode a byte string use Base64.
29+
Encode a byte string using Base64.
2830

2931
*s* is the string to encode. Optional *altchars* must be a string of at least
3032
length 2 (additional characters are ignored) which specifies an alternative
@@ -39,9 +41,9 @@ The modern interface provides:
3941

4042
Decode a Base64 encoded byte string.
4143

42-
*s* is the string to decode. Optional *altchars* must be a string of at least
43-
length 2 (additional characters are ignored) which specifies the alternative
44-
alphabet used instead of the ``+`` and ``/`` characters.
44+
*s* is the byte string to decode. Optional *altchars* must be a string of
45+
at least length 2 (additional characters are ignored) which specifies the
46+
alternative alphabet used instead of the ``+`` and ``/`` characters.
4547

4648
The decoded byte string is returned. A :exc:`TypeError` is raised if *s* were
4749
incorrectly padded or if there are non-alphabet characters present in the
@@ -81,9 +83,9 @@ The modern interface provides:
8183

8284
Decode a Base32 encoded byte string.
8385

84-
*s* is the string to decode. Optional *casefold* is a flag specifying whether a
85-
lowercase alphabet is acceptable as input. For security purposes, the default
86-
is ``False``.
86+
*s* is the byte string to decode. Optional *casefold* is a flag specifying
87+
whether a lowercase alphabet is acceptable as input. For security purposes,
88+
the default is ``False``.
8789

8890
:rfc:`3548` allows for optional mapping of the digit 0 (zero) to the letter O
8991
(oh), and for optional mapping of the digit 1 (one) to either the letter I (eye)
@@ -130,8 +132,8 @@ The legacy interface:
130132
.. function:: decodebytes(s)
131133
decodestring(s)
132134

133-
Decode the bytestring *s*, which must contain one or more lines of base64
134-
encoded data, and return a bytestring containing the resulting binary data.
135+
Decode the byte string *s*, which must contain one or more lines of base64
136+
encoded data, and return a byte string containing the resulting binary data.
135137
``decodestring`` is a deprecated alias.
136138

137139

@@ -147,8 +149,8 @@ The legacy interface:
147149
.. function:: encodebytes(s)
148150
encodestring(s)
149151

150-
Encode the bytestring *s*, which can contain arbitrary binary data, and
151-
return a bytestring containing one or more lines of base64-encoded data.
152+
Encode the byte string *s*, which can contain arbitrary binary data, and
153+
return a byte string containing one or more lines of base64-encoded data.
152154
:func:`encodebytes` returns a string containing one or more lines of
153155
base64-encoded data always including an extra trailing newline (``b'\n'``).
154156
``encodestring`` is a deprecated alias.

0 commit comments

Comments
 (0)