[wingide-users] breakpoint at end of function

Tom Stambaugh tms at zeetix.com
Mon Aug 16 17:01:51 MDT 2010

Don't forget that breakpoints on "pass" statements don't necessarily 
pause the interpreter (sometimes, but not always).

I define a "doNothing_" method at the root of the class hierarchy, and 
define it to take a single comment string as its argument:

def doNothing_(self, aCommentString):

I frequently put this at the end of a method (especially those without 
an explicit return), add an explanatory comment, and set the breakpoint 
at the doNothing_call:

def someMethod(self):
   # blah blah blah
   self.doNothing_("Did I really do a cool thing?")

Now, it reliably stops. The comment helps me remember why I cared.

This is an example of a code pattern I have called "Marker Method". When 
I'm in the middle of active development on multiple classes, I can put 
in a (limited) number of marker method calls and then use the 
search-in-files method to find them later.

Here are some marker methods I use:

def underConstruction(self):
    # either pass or halt, depending on your choice

def shouldNotCall(self):
    """I use this to catch obsolete methods that I'm replacing."""
    self.error_('Should not call')

self deprecated_(self, aCommentString):
    """Uses aCommentString to identify the new method."""

This pattern is suggested by Smalltalk's "subclassResponsibility" (or 
"implementedBySubclass") method.


Wingware Support wrote:
> Mitchell L Model wrote:
>> I think this has come up before but I can't find it: is there a way to 
>> set a breakpoint at the end of a function (other than adding a pass 
>> statement to it and putting the breakpoint there) and is there a way 
>> to "watch" the return value (it's great that it's included in Stack 
>> Data, but sometimes I want it in a Watch 
>> display)._________________________________________________
> No, there isn't a way to break on return yet.  In many cases you can of 
> course set a breakpoint on the last line of code and hit Step Over once.
> Also, it appears watching the return doesn't work either.
> Both of these would be good enhancements so I'll add them to our list if 
> not already there.
> Thanks,

Tom Stambaugh, Founder
Zeetix LLC/ZeeGuide/ZeeForge
63 Boston Ave
Somerville, MA 02144
617-776-8934 (land)
617-721-0446 (cell)

More information about the wingide-users mailing list