By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,595 Members | 1,433 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,595 IT Pros & Developers. It's quick & easy.

Re: Type feedback tool?

P: n/a
On 2008-10-26 13:54, Martin Vilcans wrote:
Hi list,

I'm wondering if there's a tool that can analyze a Python program
while it runs, and generate a database with the types of arguments and
return values for each function. In a way it is like a profiler, that
instead of measuring how often functions are called and how long time
it takes, it records the type information. So afterwards, when I'm
reading the code, I can go to the database to see what data type
parameter "foo" of function "bar" typically has. It would help a lot
with deciphering old code.

When I googled this, I learned that this is called "type feedback",
and is used (?) to give type information to a compiler to help it
generate fast code. My needs are much more humble. I just want a
faster way to understand undocumented code with bad naming.
You could try the trace module:

but I'm not sure whether that includes parameter listings.

Or write your own tracing function and then plug it into your
application using sys.settrace():

The frame object will have the information you need:

in f_locals.

Marc-Andre Lemburg

Professional Python Services directly from the Source (#1, Oct 27 2008)
>>Python/Zope Consulting and Support ...
mxODBC.Zope.Database.Adapter ...
mxODBC, mxDateTime, mxTextTools ...
__________________________________________________ ______________________

:::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: Software, Skills and Services GmbH Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
Registered at Amtsgericht Duesseldorf: HRB 46611
Oct 27 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.