[Numpy-discussion] Small fix to Numexpr getType()
Ivan Vilata i Balaguer
ivilata at carabos.com
Wed Dec 27 03:23:26 EST 2006
Hi all,
According to Travis' advice in a prevoius thread (see
http://www.mail-archive.com/numpy-discussion%40scipy.org/msg00442.html),
I have modified the ``compiler.getType()`` function in Numexpr so that
it uses the ``dtype.kind`` attribute instead of ``issubclass()``. The
patch is attached.
By the way, what is the proper casing of "Numexpr"? :)
::
Ivan Vilata i Balaguer >qo< http://www.carabos.com/
Cárabos Coop. V. V V Enjoy Data
""
-------------- next part --------------
Index: compiler.py
===================================================================
--- compiler.py (revision 2465)
+++ compiler.py (working copy)
@@ -554,14 +554,14 @@
def getType(a):
- t = a.dtype.type
- if issubclass(t, numpy.bool_):
+ kind = a.dtype.kind
+ if kind == 'b':
return bool
- if issubclass(t, numpy.integer):
+ if kind in 'iu':
return int
- if issubclass(t, numpy.floating):
+ if kind == 'f':
return float
- if issubclass(t, numpy.complexfloating):
+ if kind == 'c':
return complex
raise ValueError("unkown type %s" % a.dtype.name)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 309 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20061227/f58af7b4/attachment.sig>
More information about the NumPy-Discussion
mailing list