Hi! I sent a fix to issue #7805 which is about forcing the method _contains of an Interval to return False when the element is a Set (currently it's throwing an exception). My fix is just a check on the type of other in that method - if it's a set, I return False.
I was thinking, could we add for all the classes that inherit from Set a list of types that can be contained? For Interval, I would have to add in the __new__ method: self.containedTypes = [float, int] #and possibly other numerical types. Then, I could change my _contains method for any class implementing Set in the following way: def _contains(self, other): if type(other) is not Symbol and not any(map(lambda t: isinstance(other, t), self.containedTypes)): return False #do the actual calculations to see if other is contained, which will depend on the class we are implementing That way, I automatically ensure that other will be of the types contained by my Set, and I would be able to extend that to more complicated sets (say, a set of sets...). Let me know what you think! Sam -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. Visit this group at http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/1f2dabe5-3c42-4948-84e3-b2bee0ce5387%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.