Kent Johnson wrote: > Ismael Garrido wrote: > >> I have attached the code, I hope that's fine. If you have any further >> optimization suggestions I would be very glad to hear them :) >> > > generarResist() is doing a lot more work than necessary. Because i and j > both iterate the entire list, you will generate all pairs twice. Since > Resistencia(i,j) is equivalent to Resistencia(j,i) you would be better > off having j just go through the part of the list starting from i. You > can do this by iterating over indices instead of values. > > Second, Resistencia(i,j).posible is going to be the same as > Resistencia(i,j, False).posible because they use the same resistors. So > there is no need to try Resistencia(i,j, False) if > Resistencia(i,j).posible is False. >
Thanks for your reply! You're *very* right about that! :D Do you have any idea about the difference in calls to the compares? Should I always inherit from object in my classes? Thanks Ismael _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
