[Numpy-discussion] Current ufunc signatures for review
Charles R Harris
charlesr.harris@gmail....
Sun May 25 13:43:39 CDT 2008
On Sun, May 25, 2008 at 12:12 PM, Charles R Harris <
charlesr.harris@gmail.com> wrote:
> Hi All,
>
> Here is the current behavior of the ufuncs and some comments. They don't
> yet cover mixed types for binary functions,
> but when they do we will see things like:
>
> In [7]: power(True,10)
> Out[7]:
> array([ 0.5822807 , 0.66568381, 0.11748811, 0.97047323, 0.60095205,
> 0.81218886, 0.0167618 , 0.80544138, 0.59540082, 0.82414302])
>
> Which looks suspect ;)
>
> 1) Help strings on ufuncs don't work. This seems to be a problem with the
> help function, as
> printing the relevant __doc__ works fine. The docstrings are currently
> defined in
> code_generators/generate_umath.py and add_newdoc doesn't seem to work
> for them.
>
> 2) Complex divmod(), // and % are deprecated, should we make them raise
> errors?
>
> 3) The current behavior of remainder for complex is bizarre. Nor does it
> raise a deprecation warning.
>
> 4) IMHO, absolute('?') should return 'b'
>
> 5) Negative applied to '?' is equivalent to not. This gives me mixed
> feelings; the same functionality
> is covered by invert and logical_not.
>
> 6) The fmod ufunc applied to complex returns AttributeError. Shouldn't it
> be a TypeError?
>
> 7) Should degrees and radians work on complex? Hey, they work on booleans
> and it's just scaling.
>
Let me add that I have mixed feelings about overloading *any* of the
arithmetic operators for booleans, I think they should all promote the kind.
But I can see some virtue in the current behavior when one wants to write
out a complicated boolean expression. However, overloading - with ^ violates
the symmetry of the latter operator. Nor will -(a - b) be equivalent to b -
a.
Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080525/3e0fadb0/attachment.html
More information about the Numpy-discussion
mailing list