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 Jimbofbx
Recipients Jimbofbx, Ramchandra Apte, jcea, serhiy.storchaka, skrah
Date 2012-04-05.16:33:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1333643598.75.0.708280665281.issue14478@psf.upfronthosting.co.za>
In-reply-to
Content
I presume you mean in 3.2? Have you looked at the source code for that decorator? It's fundamentally a try/except but with a lot more unnecessary bloat than is needed for caching a single int result from a function with no arguments. Its actually a lot slower.

If this is likely going to see use in 3.3 then it would probably just be a long int since 3.3 uses C. 0 would indicate uncalculated.

Hash function would have to be set up to never return 0.

Also every function would need to be tested to make sure there isn't any "in-place" modification of the Decimal object that could alter the hash value.

I like how the cached hash in 3.3 is faster than int for hashing. Shouldn't an int just return itself? Why would it be slower?
History
Date User Action Args
2012-04-05 16:33:18Jimbofbxsetrecipients: + Jimbofbx, jcea, skrah, Ramchandra Apte, serhiy.storchaka
2012-04-05 16:33:18Jimbofbxsetmessageid: <1333643598.75.0.708280665281.issue14478@psf.upfronthosting.co.za>
2012-04-05 16:33:18Jimbofbxlinkissue14478 messages
2012-04-05 16:33:17Jimbofbxcreate