Obtaining the Python Control Flow Graph

Paul Boddie paul at boddie.org.uk
Mon Apr 3 07:12:44 EDT 2006


brianlum at gmail.com wrote:
>
> I was wondering if anyone had any advice on the best way to obtain a
> control flow graph.  I need the control flow graph because I am trying
> figure out if there is a way to bound the integer ranges and list
> lengths at compile time.

Although I haven't actually been generating control flow graphs as
such, the analysis distribution [1] produces both HTML summaries and C
source code for Python programs of a certain level of sophistication,
and I'm currently trying to finish off a new release which exposes
different strategies for deducing types and specialising functions. You
probably want to read Mark Dufour's ShedSkin paper [2] to get an idea
about how hard this kind of stuff is, and a dose of defeatism might
also be necessary given that your problem may not be solvable in
general. ;-)

Paul

[1] http://www.boddie.org.uk/python/analysis.html
[2] http://kascade.org/optimizing_python.pdf




More information about the Python-list mailing list