On Dec 6, 2008, at 9:48 PM, Tim Lahey wrote: > > Hi, > > This is more of a python question than a Sage one, > but I kind of need to figure this out for the > integral test suite. I'd like to pass the name of > a function into another function in order to > carry out the comparison. This may change depending > on the integral so I'd like to store the name in > a list. > > Is there an easy way to do this in Python? Or should > I just bite the bullet and make a class and pass an > object, instead?
In Python you can pass functions around just like anything else. For example sage: def foo(x): return x*x ....: sage: def call_it(f, n): return f(n) ....: sage: call_it(foo, 5) 25 - Robert --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
