This may sound like a stupid thing to want to achieve. The context is Test-Driven Development: I have a method which involves stepping down through the nodes of a tree, and to develop this function I have gone:
"look at child nodes"
"if child node has children, then look at grandchild nodes"
"if grandchild node has children, then look at great-grandchild nodes"... etc.
And so you get to a point where you have to replace this code with a recursive method. If you are using TDD you want to write an assertion statement which fails if your method is not recursive. This may sound silly to non-TDD people, but one point is that trees typically involve quite a lot of recursive functionality, so it actually feels "bad" to skip this sort of test step!
I'm wondering if the inspect module might have what I need... but I'm struggling. It seems to me that in an ideal world you would want to detect this recursiveness without actually having to call the method.