On 16 Mar 2013 11:49, "Dmitrey" <tmp50@ukr.net> wrote:
>>>>> --- Исходное сообщение ---
> От кого: "Matthieu Brucher" <matthieu.brucher@gmail.com>
> Дата: 16 марта 2013, 12:39:07
>>> Even if they have different hashes, they can be stored in the same
underlying list before they are retrieved. Then, an actual comparison is
done to check if the given key (i.e. object instance, not hash) is the same
as one of the stored keys.
>>>>> but, as I have already mentioned, comparison of oofun(s) via __le__,
__eq__ etc doesn't change their inner state (but the methods can create
additional oofun(s), although).
> I have checked via debugger - my methods __le__, __eq__, __lt__, __gt__,
__ge__ are not called from the buggy place of code, only __hash__ is called
from there. Python could check key objects equivalence via id(), although,
but I don't see any possible bug source from using id().
Dict lookup always calls both __hash__ and __eq__. I guess it might use
id() to shortcut the __eq__ call in some cases - there are some places in
python that do.
Anyway there's no point trying to debug this code by ESP... It's not even
clear from what's been said whether dict lookups have anything to do with
the problem.
-n
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20130316/e26ed190/attachment.html