[Numpy-discussion] repr for numarray

Konrad Hinsen hinsen at cnrs-orleans.fr
Tue Jun 11 12:27:05 CDT 2002


"Perry Greenfield" <perry at stsci.edu> writes:

> 3) Print the array if it has fewer than THRESHOLD number of
> elements, otherwise print a summary. THRESHOLD may be adjusted
> by the user.
> 
> The last appears to be the most utilitarian to us, yet
> 'impure' somehow.  Certainly there are may objects for which
> Python does not attempt to generate a string from repr that
> could be used with eval to recreate them. On the other hand,
> we are unaware of cases where repr sometimes does and sometimes

I don't see the problem. The documented behaviour would be
that it doesn't allow reconstruction. If for some arrays
that works nevertheless, who is going to complain?

BTW, it would be nice if the summary would contain the values of
some elements, to allow a quick identification of NaN arrays
and similar problems.

> does not. For example, strings may also get very large, but
> there is no threshold for generating the string.

Right. But in practice strings rarely do get that large. Arrays do.

Konrad.
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                            | E-Mail: hinsen at cnrs-orleans.fr
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24
Rue Charles Sadron                       | Fax:  +33-2.38.63.15.17
45071 Orleans Cedex 2                    | Deutsch/Esperanto/English/
France                                   | Nederlands/Francais
-------------------------------------------------------------------------------




More information about the Numpy-discussion mailing list