Comment #4 on issue 2689 by smi...@gmail.com: Set and Dict args should be sorted
http://code.google.com/p/sympy/issues/detail?id=2689

OK, I have the basics defined (__eq__, __cmp__, __iter__ and sort the
args) so now:

    >>> args = [(1,2),(2,1)]
    >>> for o in [Dict, Tuple, Set]:
    ...   if o != Tuple: assert o(*args) == o(*reversed(args))
    ...   l = [o(*args), o(*reversed(args))]
    ...   assert sorted(l) == sorted(reversed(l))
    ...
    >>> for i in Dict(*args):
    ...  print i
    ...
    1
    2
    >>> for i in Set(*args):
    ...  print i
    ...
    (1, 2)
    (2, 1)
    >>> for i in Tuple(*args):
    ...  print i
    ...
    (1, 2)
    (2, 1)

But maybe Basic should be defining __iter__ (to iter over args)
__cmp__ and __eq__. Is there any reason not to have it so?

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to sympy-issues@googlegroups.com.
To unsubscribe from this group, send email to 
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to