Ask Your Question

newbiesage's profile - activity

2019-07-08 19:59:41 +0200 received badge  Student (source)
2019-07-05 17:39:46 +0200 asked a question Sage cannot find user defined contains method

What am I doing wrong?

class Circle:
    def __init__(self, m, r):
        self.xm = m[0]
        self.ym = m[1]
        self.r = r

    def __str__(self):
        return "Circle"

    def __contains__(self, point):
        return True

In Sage:

sage: c = Circle((0,0),1) 
sage: print (0,0) in c
TypeError: argument of type 'instance' is not iterable