James Hutchison <jamesghutchi...@gmail.com> added the comment:

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?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue14478>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to