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

Ivan Vilata i Balaguer ivan@selidor....
Tue Jul 29 13:38:13 CDT 2008


David Huard (el 2008-07-29 a les 12:31:54 -0400) va dir::

> 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 subs:
> 
> >>> 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.

Umm, that looks like a big change (or addition) to the NumPy interface.
I think similar "include a dtype argument for method X" issues hava been
discussed before in the list.  However, given the big change of adding
the new explicit operation methods I think your proposal falls beyond
the scope of the project being discussed.

However, since yours isn't necessarily a time-related proposal, you may
ask what people think of it in a separate thread.

::

  Ivan Vilata i Balaguer   @ Intellectual Monopoly hinders Innovation! @
  http://www.selidor.net/  @     http://www.nosoftwarepatents.com/     @
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: Digital signature
Url : http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080729/ee8a5e64/attachment.bin 


More information about the Numpy-discussion mailing list