[Numpy-discussion] The date/time dtype and the casting issue

Francesc Alted faltet@pytables....
Tue Jul 29 13:08:28 CDT 2008

A Tuesday 29 July 2008, David Huard escrigué:
> Hi,
> Silent casting is often a source of bugs and I appreciate the strict
> rules you want to enforce.
> However, I think there should be a simpler mechanism for operations
> between different types
> than creating a copy of a variable with the correct type.
> My suggestion is to have a dtype argument for methods such as add and 
> >>> numpy.ones(3, dtype="t8[Y]").add(numpy.zeros(3, dtype="t8[fs]"),
> dtype="t8[fs]")
> This way, `implicit` operations (+,-) enforce strict rules, and
> `explicit` operations (add, subs) let's
> you do want you want at your own risk.

Hmm, the idea of the ``.add()`` and ``.subtract()`` methods is tempting, 
but I not sure it is a good idea to add new methods to the ndarray 
object that are meant to be used with just the date/time dtype.

I'm afraid that I'm -1 here.


Francesc Alted

More information about the Numpy-discussion mailing list