This does not look recursive to me, since possible_values() does not call itself.
John 2008/8/25 Rolandb <[EMAIL PROTECTED]>: > > Hi. The following programme looks simple: > > sage: def posible_values(row,found,maxum): > ... result=found > ... if row==[]: row=[1] > ... if result==[]: result=found=row #Recursion: > intended or unintended? > ... if max(row)<maxum: > ... for k in found: > ... for p in row: > ... if k*p <maxum: > ... if k*p not in result: result.append(k*p) > ... return result > ... > sage: print posible_values([2,3,5],[],100) > [2, 3, 5, 4, 6, 10, 8, 12, 20, 16, 24, 40, 32, 48, 80, 64, 96, 9, 15, > 18, 30, 36, 60, 72, 27, 45, 54, 90, 81, 25, 50, 75] > > To me is the possibility of recursion this way a great plus, but in > all documents I could not find any reference. So is this intended in > Python/SAGE or is the above example just bad programming? Roland > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---
