[Python-checkins] bpo-33032: Mention the implicit cache in struct.Struct() docs (GH-7700)
Miss Islington (bot)
webhook-mailer at python.org
Tue Sep 11 00:50:46 EDT 2018
https://github.com/python/cpython/commit/2110f78d92522499836a928d268704fdc5f7a037
commit: 2110f78d92522499836a928d268704fdc5f7a037
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018年09月10日T21:50:41-07:00
summary:
bpo-33032: Mention the implicit cache in struct.Struct() docs (GH-7700)
Mention the implicit cache in struct.Struct() docs.
Consistent with the re.compile documentation note.
(cherry picked from commit 3666b3c1f695a145adab1bf644c22e564e8eb0ee)
Co-authored-by: Zackery Spytz <zspytz at gmail.com>
files:
M Doc/library/struct.rst
diff --git a/Doc/library/struct.rst b/Doc/library/struct.rst
index 2d0866c7e09e..f10fbe4fc0df 100644
--- a/Doc/library/struct.rst
+++ b/Doc/library/struct.rst
@@ -405,6 +405,12 @@ The :mod:`struct` module also defines the following type:
methods is more efficient than calling the :mod:`struct` functions with the
same format since the format string only needs to be compiled once.
+ .. note::
+
+ The compiled versions of the most recent format strings passed to
+ :class:`Struct` and the module-level functions are cached, so programs
+ that use only a few format strings needn't worry about reusing a single
+ :class:`Struct` instance.
Compiled Struct objects support the following methods and attributes:
More information about the Python-checkins
mailing list