efficient way for building class browsers.

Josiah Carlson jcarlson at nospam.uci.edu
Sun Feb 8 02:18:07 EST 2004


> I am looking for a class browser that has these features.

Only a browser?  Text or GUI?  What OS?  Any particular GUI toolkit?

> Remember I need a class browser, that also tells me the line no in
> source code of that symbol. (So compiler module  (ast) can't be used -
> Is it so? )

compiler.ast can be used for this, but only produces proper results when 
the file has no syntax errors.  Don't get me wrong, using the output of 
compiler.ast can be a pain in the ass, and slow as hell (5 seconds for 
100k of source on a celeron 400), but it can be used.

> Are there any better ways for achieving this?

You can write a limited parser (subject to certain flaws), one that 
doesn't use tokenize or compiler.ast, and get pretty fast results.  I 
wrote one to go into my own editor PyPE (pype.sourceforge.net), and it 
has no problems parsing a 100k Python source file and displaying the 
source tree in a GUI in less than 1/2 second on a celeron 400.

It wouldn't be too bad to pull the tree portion out, what kind of 
browser do you need?

  - Josiah



More information about the Python-list mailing list