This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Mention implicit cache in struct.Struct docs
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.8, Python 3.7, Python 3.6
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: ZackerySpytz, docs@python, gregory.p.smith, miss-islington, ncoghlan
Priority: normal Keywords: patch

Created on 2018-03-08 23:22 by ncoghlan, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 7700 merged ZackerySpytz, 2018-06-15 08:02
PR 9160 merged miss-islington, 2018-09-11 04:37
Messages (5)
msg313468 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2018-03-08 23:22
The struct.Struct docs claim that creating and re-using a Struct object will be noticeably faster than calling the module level methods repeatedly with the same format string, as it will avoid parsing the format string multiple times:

This claim is questionable, as struct has used an internal Struct cache since at least 2.5, so if you're using less than 100 different struct layouts in any given process, the only thing you'll be saving is a string-keyed dictionary lookup.
msg313470 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2018-03-08 23:27
The note on provides a useful precedent for possible wording here, as the struct cache and the regex cache are quite similar.
msg324981 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2018-09-11 04:37
New changeset 3666b3c1f695a145adab1bf644c22e564e8eb0ee by Gregory P. Smith (Zackery Spytz) in branch 'master':
bpo-33032: Mention the implicit cache in struct.Struct() docs (GH-7700)
msg324983 - (view) Author: miss-islington (miss-islington) Date: 2018-09-11 04:50
New changeset 2110f78d92522499836a928d268704fdc5f7a037 by Miss Islington (bot) in branch '3.7':
bpo-33032: Mention the implicit cache in struct.Struct() docs (GH-7700)
msg324985 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2018-09-11 04:56
Date User Action Args
2022-04-11 14:58:58adminsetgithub: 77213
2018-09-11 04:56:29gregory.p.smithsetstatus: open -> closed
resolution: fixed
messages: + msg324985

stage: patch review -> resolved
2018-09-11 04:50:46miss-islingtonsetnosy: + miss-islington
messages: + msg324983
2018-09-11 04:37:45miss-islingtonsetpull_requests: + pull_request8604
2018-09-11 04:37:36gregory.p.smithsetnosy: + gregory.p.smith
messages: + msg324981
2018-06-15 08:03:42ZackerySpytzsetnosy: + ZackerySpytz
2018-06-15 08:02:27ZackerySpytzsetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request7316
2018-03-08 23:27:51ncoghlansetmessages: + msg313470
2018-03-08 23:22:58ncoghlancreate