[wingide-users] inspecting List type clases in wing

Jacob Lundqvist jaclu2 at galdrion.com
Fri Oct 8 05:46:50 EDT 2004


Hi,
I have had a problem with wing (and other IDEs that display stack-data)

If you have a class that does somethin "heavy" on the __len__() and or 
__getitem__() operators you run into problems because each step in the 
debuger those methods gets called. And if its a network/db class it can 
take a loong time...

First I named my instances of the class in prefs-Debuger-Data Filters
but that was to much, now it disapeared so much that I couldnt see the 
data at all.

My new hack is this, using inspect and aborting if the call is from 
wing-internal methods, not perfect but it work ok, performance isnt 
penalized to much and I can see most stuff in the debugger

----------------
import inspect

Class foo:
     def __len__(self):
	if inspect.stack()[1][3] == 'safelen': return 0 #winginternal
	...

     def __getitem__(self, item):
	if inspect.stack()[1][3] == '__GetValueDict': return None
	...
-----------------

Now to my question, is there some way to handle this in a more general way?

	regards /Jacob L


More information about the wingide-users mailing list