On Wed, Dec 29, 2010 at 10:13 AM, Matthew Brett <matthew.br...@gmail.com> wrote: >>> Forgive me if I haven't understood your question, but can you use >>> PyArray_DescrFromType with e.g NPY_FLOAT64 ? >> >> I'm pretty hopeless here. I don't know how to put all that together in >> a function. > > That might be because I'm not understanding you very well, but I was > thinking that: > > cdef dtype descr = PyArray_DescrFromType(NPY_FLOAT64) > > would give you the float64 dtype that I thought you wanted? I'm > shooting from the hip here, in between nieces competing for the > computer and my attention.
I think I need a function. One that does this: >> n = 10.0 >> hasattr(n, 'ndim') False >> m = np.float64(n) >> hasattr(m, 'ndim') True np.float64 is fast, just hoping someone had a C-API inline version of np.float64() that is faster. _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion