Ad
  • Custom User Avatar

    PS: that means this case is out of the scope of the kata, btw, if obj is the instance and not the class itself. But your code shouldn't raise in any case.

  • Custom User Avatar

    all methods are assigned directly to the class, and not to instances, now. So your code shouldn't actually raise an error for this specific case, afaik.

  • Custom User Avatar

    That test checks whether object methods can access the implicitely passed variable (normally called self). Note this should work, whether the variable is called self or something else. Looking at your code, I think you are having trouble with that second part.

    As an example, this code should work:

    class A:
        val = 5
        def get_v(self):
            return self.val
        def double_v(me):
            return me.val*2
    the_ob = A()
    print(the_ob.get_v()) # 5
    print(the_ob.double_v()) # 10