Comment #16 on issue 1026 by [email protected]: pypy doesn't run sympy http://code.google.com/p/sympy/issues/detail?id=1026
Next issue:
a, b = symbols('a,b') s = Segment((0, a), (0, b)) assert Point(0, (a + b)/2) in s
gives False in CPython, None in pypy. In this case, pypy is correct - there's no way to know for certain, so the logic implemented in Segment.__contains__() says that this should return None.
The problem is that CPython converts __contains__() output to a boolean, so it gives False. The official docs (http://docs.python.org/reference/datamodel.html#object.__contains__) says __contains__ should return either True or False, so that behavior is not unreasonable, pypy just doesn't enforce it.
I think the way to go is to implement a 'contains' method, avoiding the special methods. This spoils the nice syntax "point in segment" (that is used a lot BTW), but I don't see any other way. The current result in CPython is just wrong.
-- 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.
