Apr-15-2021, 10:25 AM
Hello,
I have a class and inside this class I have this function:
Apart from that, I have also an external function which is using my ff fucntion:
I have a class and inside this class I have this function:
def ff(self, timelimit): while self.lasttime < timelimit : ... do your stuff self.otherpart.messagelist.append((self.lasttime + self.delaytime, self.fakeid)) return NoneAnd of course I have also init and iter function inside my class
Apart from that, I have also an external function which is using my ff fucntion:
def Simulatetilltime(A, timelimit): B=A.otherport Alist = [] Blist = [] A.lastt while A.lasttime < timelimit : try: if A.lasttime <= B.lasttime : x=A.ff( B.lasttime+A.delaytime) if x!=None: Alist.append(x) else : print("Here we are****************************************************") x=B.ff( A.lasttime+B.delaytime) if x!=None: Blist.append(x) except StopIteration: break return Alist, BlistI want to create a generator inside the class instead of using just function. How can I do that?