From 3666b3c1f695a145adab1bf644c22e564e8eb0ee Mon Sep 17 00:00:00 2001 From: Zackery Spytz Date: Mon, 10 Sep 2018 22:37:33 -0600 Subject: [PATCH] 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. --- Doc/library/struct.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Doc/library/struct.rst b/Doc/library/struct.rst index d6a3cb721e8..bad33ac666e 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: