[pypy-dev] numpypy: could NaN be added?

Dmitrey dmitrey15 at ukr.net
Sat Jan 21 12:25:29 CET 2012


On 01/21/2012 01:21 PM, Dmitrey wrote:
> hi all,
>
> absence of numpypy.nan prevents creating lots of highly important 
> funcs like isnan, nanmin, nanmax, nanargmin, nanargmax, nansum etc. I 
> cannot guarantee I would immediately provide them, especially for 
> multidimensional arrays, but, at least, I (or other programmers) could 
> create temporary replacements for the absent yet funcs in their own 
> code (for example, only for 1-dimensional or at most 2-dimensional 
> arrays), making their code working in PyPy right now.
>
> So could you put the number into numpypy, or there are some difficult 
> problems with it?
I see nan is somehow present in pypy code, but I cannot acces it from 
neither numpypy nor pypy:
 >>>> a = np.inf - np.inf
 >>>> a
nan
 >>>> type(a)
<type 'float'>
 >>>> nan
Traceback (most recent call last):
   File "<console>", line 1, in <module>
NameError: global name 'nan' is not defined
 >>>> np.nan
Traceback (most recent call last):
   File "<console>", line 1, in <module>
AttributeError: 'module' object has no attribute 'nan'
-----------------------
Regards, D.
http://openopt.org/Dmitrey



More information about the pypy-dev mailing list