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 3666b3c1f6)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
This commit is contained in:
Miss Islington (bot) 2018-09-10 21:50:41 -07:00 committed by GitHub
parent 9c4a63fc17
commit 2110f78d92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -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 methods is more efficient than calling the :mod:`struct` functions with the
same format since the format string only needs to be compiled once. 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: Compiled Struct objects support the following methods and attributes: