Status: Accepted
Owner: [email protected]
Labels: Type-Defect Priority-High

New issue 2389 by [email protected]: Semantic inconsistency between Basic.__contains__ and Tuple.__contains__
http://code.google.com/p/sympy/issues/detail?id=2389

According to the implementation in Basic.__contains__, 'A in B' means 'Is A part of the expression tree for B?', but for objects that are naturally considered containers, like Tuple or Set, 'A in B' means 'Is A an element of B?'. These definitions are incompatible (consider '2 in Interval(1, 3)' or 'x in Tuple(x+1, y)') and lumping them together with the same syntax is bound to create difficult problems.

The problem with the first definition is that it confuses the object with its expression tree, while they are considered nearly everywhere else in sympy. Besides, there's already a method which has basically the same meaning, .has(). So I think that Basic.__contains__ should just be removed and its functionality merged with Basic.has().

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

Reply via email to