[SciPy-user] changing what is printed to the command prompt

Fernando Perez Fernando.Perez at colorado.edu
Fri Nov 4 17:05:23 EST 2005


Ryan Krauss wrote:
> This is really more of a pure python question but here goes....
> 
> I have a user defined class and when I type the variable name at the
> command prompt I get:
> 
> In [29]: temp
> Out[29]: <rwkbode.bodeout instance at 0xb3e33e4c>
> 
> Can I define a method that would make this print something more
> useful?  I guess I am really asking, is there a Python method that is
> calls for each class when just the variable name is typed at the
> command prompt.  I tried a __str__ method, but that didn't work.

__repr__

Cheers,

f




More information about the SciPy-User mailing list