Re: Re: mx.DateTime 3.2.x and numpy

Jim Vickroy <[email protected]> Thu, 22 Dec 2011 13:52:04 -0700
Newsgroups gmane.comp.python.egenix.user
Message-ID <CADb5Cehj=AHMzZLwNtVq7fE6ZiJAjJeJotVDn7JCmHVdbhjAgg@mail.gmail.com>
On Thu, Dec 22, 2011 at 10:57 AM, V <[email protected]> wrote:

> Jim Vickroy <jim.vickroy@...> writes:
> >
> > For what it is worth, as a mere "lurker" on this list,
> > that is an error in the numpy implementation, and should be reported.
> > My search attempts to find information on a justification for this
> > behavior are so far unsuccessful.
>
> Hmm, gmane seems to have swallowed my previous couple attempts to send a
> response... Perhaps it got labeled as spam due to inclusion of a link to
> numpy
> documentation. Aany way,
>
> Jim, I believe that this is not actually a bug in numpy, but rather desired
> behavior. Documentation for numpy.ndarray.__float__ includes the following
> snippet:
>
> "
> Conversion; the operations complex, int, long, float, oct, and hex.
> They work only on arrays that have one element in them and return
> the appropriate scalar.
>  "
>
>
> Thanks for this information -- and good detective work to diagnose the
original error.

I do think, however, this is an unfortunate numpy design decision.  I would
rather __float__ not be provided at all since it only behaves as expected
for a trivial corner case.  This is, to me, very unintuitive.

-- jv


>  _______________________________________________________________________
> eGenix.com User Mailing List                     http://www.egenix.com/
> https://www.egenix.com/mailman/listinfo/egenix-users
>


_______________________________________________________________________
eGenix.com User Mailing List                     http://www.egenix.com/
https://www.egenix.com/mailman/listinfo/egenix-users