From: Ryan K. <rk...@si...> - 2013-06-10 15:53:35
|
I probably won't get to this one for a few weeks (I have a conference and another paper coming up), but I would like to contribute a __repr__ method for TransferFunctions if it would be welcome. I personally would prefer that when I type the name of a TransferFunction instance and hit enter that it pretty print an ascii numerator and denominator and a horizontal line. It might be tricky to do it really nicely with exponents, but this is what happend now: In [2]: G = control.TransferFunction(1,[1,2]) In [3]: G Out[3]: <control.xferfcn.TransferFunction instance at 0x10e94cf80> I then have to ask ro G.num and G.den separately, which I personally don't like. I see that there is a __str__ method which pretty much does what I would want, so that "print G" gives me an ascii representation. Is there any reason not to have __repr__ simply call __str__? Is there some historical reason to have one and not the other? -- Ryan Krauss, Ph.D. Associate Professor Mechanical Engineering Southern Illinois University Edwardsville |