I'm trying to take a python class (in IronPython), apply it to some data and display it in a grid. The results of the functions become columns on the grid, and I would like the order of the functions to be the order of the columns. Is there a way to determine the order of python functions of a class in the order they were declared in the source code? I'll take answers that use either IronPython or regular python.
So for instance, if I have a class:
class foo: def c(self): return 3 def a(self): return 2 def b(self): return 1
I would like to (without parsing the source code myself) get back a list of
[c, a, b]. Any ideas?
As a caveat, IronPython used to keep the references of functions in the order they declared them. In .NET 4, they changed this behavior to match python (which always lists them in alphabetical order).