self.basedir = basedir

def __eq__(self, other):
    return type(other
        ) is RPath and self.basedir == other.basedir and self.p == other.p

def cp(self):
    return self.basedir / self.p

def __getattr__(self, attr):
    return getattr(self.cp, attr)
How to subclass a class that has a __new__ and relies on the value of cls?