views:

131

answers:

2

I have a folder full of python snippets and want to search it in a more intelligent way than grep. Is there already a script which parses python snippets to AST and lets you search it, like http://nullege.com?

For example, if you have the following code:

class InspectionFrame(wx.Frame):
    def SaveSettings(self, config):
        w, h = self.GetSize()

you should be able to search for wx.Frame.GetSize.

+1  A: 

Your idea is awesome, I'd love to see that available. FFR, this won't do what you want but it's way better than for grep for code searching: ack, it's "better than grep".

Adam Nelson
+2  A: 

To my knowledge, ctags is a classic tool for such a task. As of now, python support in exuberant ctags is lacking, but some work have been done last year: http://ctags.sourceforge.net/news.html. Now indexing of classes, functions, class members, variables and imports are supported.

fungusakafungus