Am 2014-09-18 um 16:44 schrieb Stefan:
> 
>     Is this behaviour intentional or is this a bug?
> 
> Neither, in Sage the Python promise is necessarily broken, because math 
> objects
> and equality is just too complex.

So how do I work with dict and set in sage?

I ran across the difficulty in the finite state machines module. There, states
have (hashable) labels, the hash of a state is the hash of a label, and the
machine stores a dict of its states (label is mapped to the state object). The
labels can be any hashable sage object.

Does this mean that the finite state machine module must never use constructions
like state1 == state2, but should always use hash(state1) == hash(state2) in
order to be sure not to mix up duplicates in the dict of states?

If yes, I'd tend to write a small function strictly_equal(obj1, obj2) to
encapsulate this behaviour... But then this problem should occur in many other
places in sage, too, so the problem should already have been dealt with
somewhere and have been documented e.g. in
http://www.sagemath.org/doc/developer/coding_in_python.html#the-hash-special-method?


-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to