Message157603
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? |
|
Date |
User |
Action |
Args |
2012-04-05 16:33:18 | Jimbofbx | set | recipients:
+ Jimbofbx, jcea, skrah, Ramchandra Apte, serhiy.storchaka |
2012-04-05 16:33:18 | Jimbofbx | set | messageid: <1333643598.75.0.708280665281.issue14478@psf.upfronthosting.co.za> |
2012-04-05 16:33:18 | Jimbofbx | link | issue14478 messages |
2012-04-05 16:33:17 | Jimbofbx | create | |
|