ActiveState Community

Str( ) in Python Debugger Panel ?

Posted by markb on 2009-06-24 06:00
OS: OS X

I like everything else about developing in Python with Komodo but...I am being driven INSANE by having to constantly switch to the watch tab and type str(variablename). I use numpy a lot, and values are thrashing between python types and numpy types quite often, and it is absolutely aggravating that the "value" tab on the local debugger window provides no useful information. Practically all properly behaved Python objects have a useful description provided by the str() function. This is the information that developers WANT in the value tab. Is there anyway to add this to the interface? Can I develop a plugin to do so? It is getting to the point that I am looking for new environments because it seems that this is where I am spending the vast majority of my time instead of actually debugging.

ericp | Wed, 2009-06-24 09:36

I gather you're looking for this kind of
functionality:

If a compound object has a str() representation beyond the
standard "" form, we should put
that in the Value field.

- Eric

markb | Wed, 2009-06-24 09:55

I dont know that it is a bug, but I am willing to file it as such if it helps. For instance, using Numpy I declare a variable as: x=array( [0.1,0.1,0.2] )

I would like to see [0.1,0.1,0.2] in the value column of the local debug tab. Instead i get nothing. The variable type is listed as 'ndarray' and when i expand it I see the internal structure, but the array elements are Float64s and their value is also blank. To 'solve' this I have to add a str('variablename') to the watch tab for every variable I want to look at.

It seems like the 'value' column should be putting up the result of str() for both those cases. It is useless if it is blank.

Is there anyway to write a datafilter that knows what the 'value' of things like float64s and ndarrays are? I mean in both cases its just a simple call to pythons built in str() function.

toddw | Wed, 2009-06-24 11:30

You can also hover over the variables and it should give you a better representation, see:
http://community.activestate.com/forum/numpy-arrays#comment-8668

Cheers,
Todd

markb | Wed, 2009-06-24 12:28

The hovering works ok, but it leads to a lot of scrap paper and writing things down when trying to track or compare values. Also it is very twitchy when dealing with single letter variables.

I just want to know if this is working as intended, is something I can write plugins or extensions to handle, or is just a bug?

If its something that can be changed, just point me in the right direction, I am not afraid to roll up my sleeves and get it done, it really is a major impediment to the way I would be most productive.