[wingide-users] Breakpoints at pass?

Tom Stambaugh tms at zeetix.com
Mon Mar 15 13:00:12 MDT 2010


I'm using Python 2.5, on WinXP Pro. For whatever reasons, breakpoints at 
"pass" work most of the time (perhaps through happy coincidences).

I suppose a better approach is define a "noOp" method:
     def noOp(self):
         pass

and rewrite my code example as follows:
      answer = self.someReturnValue()
      # do stuff here
      if aVariable is None:
          someVariable = self.doSomething()
      else:
          self.noOp()
      return answer

Presumably a breakpoint at the call to noOp will pause as expected.

None of these stay in the final code, this idiom is really just a stub 
method that lets me inspect local state while I write the real code that 
will go there.

Thanks,
Tom

Wingware Support wrote:
> Tom Stambaugh wrote:
>> In the following fragment of code, a breakpoint set at the "pass" is 
>> often skipped:
>>
>>     answer = self.someReturnValue()
>>     # do stuff here
>>     if aVariable is None:
>>         someVariable = self.doSomething()
>>     else:
>>         pass
>>     return answer
>>
>> A breakpoint set at the "if" statement works as expected, as does a 
>> breakpoint set at the "return" statement. I'd like to break at the
>> "pass" statement so that I can inspect local state before I write code
>> that will go there.
>>
>> Am I misunderstanding what "pass" does, or is this a bug?
> 
> "pass" generates no byte codes so the line is never executed and thus 
> the debugger can't stop there.
> If I remember correctly, this may vary by Python version.
> 

-- 
Tom Stambaugh, Founder
Zeetix LLC/ZeeGuide/ZeeForge
27 Auburn Street
Brookline, MA 02446
617-734-8934 (land)
617-721-0446 (cell)


More information about the wingide-users mailing list