--- Исходное сообщение --- От кого: "Robert Kern" <[email protected]> Дата: 16 марта 2013, 22:15:07 On Sat, Mar 16, 2013 at 6:19 PM, Dmitrey < [email protected] > wrote: > > > --- Исходное сообщение --- > От кого: "Robert Kern" < [email protected] > > Дата: 16 марта 2013, 19:54:51 > > On Sat, Mar 16, 2013 at 10:39 AM, Matthieu Brucher > < [email protected] > wrote: >> 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. > > Right. And the rule is that if two objects compare equal, then they > must also hash equal. Unfortunately, it looks like `oofun` objects do > not obey this property. oofun.__eq__() seems to return a Constraint > rather than a bool, so oofun objects should simply not be used as > dictionary keys. > > It is one of several base features FuncDesigner is build on and is used > extremely often and wide; then whole FuncDesigner would work incorrectly > while it is used intensively and solves many problems better than its > competitors. I understand. It just means that you can't oofun objects as dictionary keys. Adding a __hash__() method is not enough to make that work. No, it just means I had mapped, have mapped, map and will map oofun objects as Python dict keys. As for the bug, I have found and fixed its source (I used some info from sorted list of free variables and somew other info from a non-sorted dict of oofun sizes). D.
_______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
