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.

Author serhiy.storchaka
Recipients barry, rhettinger, serhiy.storchaka
Date 2017-11-15.22:00:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1510783216.04.0.213398074469.issue32039@psf.upfronthosting.co.za>
In-reply-to
Content
+1 to all said by Raymond. But this is rather the matter of a special article or blog post than a note in the documentation.

Other example of caching is regular expressions.

Mistakes:

python3 -m timeit -s "it = iter(range(1000000000))" "next(it)"

python3 -m timeit -s "a = []" "a.append(1)"

I remember one non-obvious trap in which I got caught. The performance of the iteration of a dict was influenced by the fact that in new dicts the order of iteration coincided with the order of creating keys, which were allocated sequentially in memory. Thus refcounts were touched in adjacent objects. This usually is not happen in real programs.
History
Date User Action Args
2017-11-15 22:00:16serhiy.storchakasetrecipients: + serhiy.storchaka, barry, rhettinger
2017-11-15 22:00:16serhiy.storchakasetmessageid: <1510783216.04.0.213398074469.issue32039@psf.upfronthosting.co.za>
2017-11-15 22:00:16serhiy.storchakalinkissue32039 messages
2017-11-15 22:00:15serhiy.storchakacreate