[Numpy-discussion] Unpleasant behavior with poly1d and numpy scalar multiplication

Fernando Perez fperez.net@gmail....
Sat Feb 13 21:02:56 CST 2010


On Sat, Feb 13, 2010 at 12:24 PM, Charles R Harris
<charlesr.harris@gmail.com> wrote:
>> One minor suggestion:  I think it would be useful to have the new
>> polys have some form of pretty-printing like the old ones.  It is
>> actually useful when working, to verify what one has at hand, to see
>> an expanded printout like the old ones do:
>>
>
> I thought about that, but decided it was best left to a derived class, say
> PrettyPoly ;) Overriding __repr__ and __str__ is an example where
> inheritance makes sense.

I disagree, I think one of the advantages of having both str and repr
is precisely to make it easy to have both a terse,
implementation-oriented representation and a more human-friendly one
out of the box.  I don't like using 'training wheels' classes, people
tend to learn one thing and use it for a long time, so I think objects
should be as fully usable as possible from the get-go.  I suspect I
wouldn't use/teach a PrettyPoly if it existed.

But it's ultimately your call.  In any case, many thanks for the code!

Best,

f


More information about the NumPy-Discussion mailing list