[Numpy-discussion] Deprecate poly1d and replace with Poly1d ?
Charles R Harris
Mon Sep 28 16:05:28 CDT 2009
On Mon, Sep 28, 2009 at 2:59 PM, Robert Kern <email@example.com> wrote:
> On Mon, Sep 28, 2009 at 15:46, Charles R Harris
> <firstname.lastname@example.org> wrote:
> > The more basic problem here is making poly1d look like an array, which it
> > isn't. The array bit is an implementation detail and would be private in
> > C++. with an as_array method to retrieve the details if wanted.
> I'm pretty sure that it is an intentional public API and not an
> implementation detail. The __array__() method is not "making poly1d
> look like an array"; it is the standard name for such as_array()
> conversion methods.
Exactly, and that is why it is a design decision error. It *shouldn't* work
with as_array unless it is *an array*, which it isn't. Really
In : sin(poly1d([1,2,3]))
Out: array([ 0.84147098, 0.90929743, 0.14112001])
That makes no sense. On the other hand, it is difficult to make arrays of
poly1d, which does make sense because the polynomials are a commutative
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion