From: Richard M. <mu...@cd...> - 2013-06-11 15:47:44
|
We should definitely do something nicer than "<control.xferfcn.TransferFunction instance at 0x10e94cf80>". What's standard for scipy objects (or scipy.signal objects)? I can imagine this eventually becoming part of scipy, so perhaps we use whatever standards exist there as a guide? -richard On 10 Jun 2013, at 8:53 , Ryan Krauss <rk...@si...> wrote: > 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 > ------------------------------------------------------------------------------ > How ServiceNow helps IT people transform IT departments: > 1. A cloud service to automate IT design, transition and operations > 2. Dashboards that offer high-level views of enterprise services > 3. A single system of record for all IT processes > http://p.sf.net/sfu/servicenow-d2d-j_______________________________________________ > python-control-discuss mailing list > pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-control-discuss |