[SciPy-dev] Some suggestions for scipy_core

Francesc Altet faltet at carabos.com
Tue Jan 3 21:16:56 CST 2006

A Dilluns 02 Gener 2006 17:54, Francesc Altet va escriure:
> Finally, I have yet another (the last one, at least for today ;-)
> question about scipy_core:
> In [35]: print scicore.typeDict['I'], scicore.typeDict['L']
> <type 'uint32_arrtype'> <type 'uint32_arrtype'>
> In [36]: scicore.typeDict['I'] == scicore.typeDict['L']
> Out[36]: False
> The same goes for:
> In [38]: print scicore.typeDict['i'], scicore.typeDict['l']
> <type 'int32_arrtype'> <type 'int32_arrtype'>
> In [39]: print scicore.typeDict['i'] == scicore.typeDict['l']
> False
> Is this consistent?. I would say no (I'm on a 32-bit platform).

I've made some progress for comparing datatypes of type 'i' and 'l'
correctly. Right now, in 32-bit platforms, scipy_core gives:

In [25]: a=scicore.arange(10,dtype='i')

In [26]: b=scicore.arange(10,dtype='l')

In [27]: a.dtypedescr == b.dtypedescr
Out[27]: False  # !!

With the attached patch (you should revise it, because I'm not used to
write C extensions in the wild way), it works as it should:

In [27]: a.dtypedescr == b.dtypedescr
Out[27]: True

However, I cannot see the way to make the a.dtype == b.dtype
comparison to work well. I'm trying to figure out where the heck
should I implement the tp_compare function for this case, but I can't.
Some clues anyone? Well, perhaps this is not very important, but I
have been bitten enough by the 'i' vs 'l' dichotomy and I'd love that
scipy_core finally does the correct thing.

BTW, it seems that support for scipy_core homogeneous arrays (both
numerical and strings) in PyTables is in place. Now, it remains
records and unicode strings. I'll keep you informed on my progress. 

>0,0<   Francesc Altet     http://www.carabos.com/
V   V   Cárabos Coop. V.   Enjoy Data

-------------- next part --------------
A non-text attachment was scrubbed...
Name: arrayobject.patch
Type: text/x-diff
Size: 1561 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/scipy-dev/attachments/20060104/3e500a97/attachment.bin 

More information about the Scipy-dev mailing list