[Python-Dev] Re: New bug in function object hash() and comparisons

Barry A. Warsaw barry@digicool.com
2001年1月27日 12:43:43 -0500


>>>>> "GvR" == Guido van Rossum <guido@digicool.com> writes:

 GvR> Clearly, something changed. I'm pretty sure it's the
 GvR> function attributes.
Actually no. func_code is used in func_hash() but somewhere in the
Python 1.6 cycle, func_code was made assignable.
 
 GvR> Either the function attributes shouldn't be used in comparing
 GvR> function objects, or hash() on functions should be
 GvR> unimplemented, or comparison on functions should use simple
 GvR> pointer compares.
 GvR> What's the right solution?
We should definitely continue to allow functions as keys to
dictionaries, but probably just remove func_code as an input to the
function's hash.
 
-Barry

AltStyle によって変換されたページ (->オリジナル) /