def is_w(self, space, other): if self.w_instance is not None: return W_Root.is_w(self, space, other) # The following special-case is only for *unbound* method objects. # Motivation: in CPython, it seems that no strange internal type # exists where the equivalent of ``x.method is x.method`` would # return True. This is unlike unbound methods, where e.g. # ``list.append is list.append`` returns True. The following code # is here to emulate that behaviour. Unlike CPython, we return # True for all equal unbound methods, not just for built-in types. if not isinstance(other, Method): return False return (other.w_instance is None and self.w_function is other.w_function and self.w_class is other.w_class)