[wingide-users] __repr__, print self and debug probe

Wingware Support support at wingware.com
Tue Sep 14 07:47:35 MDT 2010


Luc Bourhis wrote:
> Hi all,
>
> I have a class featuring a method __repr__ and a method like
>
> def show_scatterers(self):
>   # print some attributes of the class
>   return self
>
> The purpose of the return statement is to allow chaining of such operations: xs.show_summary().show_scatterers()
>
> The problem happens when I execute xs.show_scatterers() in the debug probe: not only the printing internal to that method occurs but Wing does also display the representation of that object xs because the former call return the latter object.
>
> Is there a trick I am missing that would prevent Wing from displaying repr(xs) here? I tried Preferences > Debugger > Data filters to no avail...
>   

There isn't any option to say "don't show value of things in debug 
probe".  A work-around would be to define a method noop() that returns 
nothing (same as returning None) and adding that at the end of the chain:

xs.show_summary().show_scatterers().noop()

Or something like this:

def quiet(*args, **kw):
  return

quiet(xs.show_summary().show_scatterers())

-- 

Stephan Deibel
Wingware | Python IDE
Advancing Software Development

www.wingware.com



More information about the wingide-users mailing list