python too many self in class
问题 I'm learning Python OOP and trying to convert a Java class to a Python class See page 15 in this PDF for Java code google doc link class QuickFindUF: """docstring for QuickFindUF""" def __init__(self, n): self.id = [] for e in range(n): self.id.append(e) def connected(self,p,q): return self.id[p]==self.id[q] def union(self,p,q): self.pid = self.id[p] self.qid = self.id[q] for i in range(len(self.id)): if(self.id[i]==self.pid): self.id[i]=self.qid quf = QuickFindUF(9) quf.union(3,4) print quf