Amelio Vazquez-Reina
Amelio Vazquez-Reina

Reputation: 96304

Meaning of <..> in Python inspection

In an IPython session, I have the following:

> my_array?
Type:       ndarray
String Form:
[[ 1.]
           [ 1.]
           [ 1.]
           [ 1.]
           [ 1.]
           [ 1.]
           [ 1.]
           [ 1.]
           [ 1.]
           [ 1.]
           [ 1.]
           [ 1.]
           [ 1.]
           [ 1.] <...> [ 1.]
           [ 1.]
           [ 1.]
           [ 1.]
           [ 1.]
           [ 1.]
           [ 1.]
           [ 1.]
           [ 1.]
           [ 1.]
           [ 1.]
           [ 1.]
           [ 1.]
           [ 1.]]
Length: 500

What does <...> mean above? Do I have a 1D array of 1D arrays or something else?

Upvotes: 2

Views: 114

Answers (1)

DSM
DSM

Reputation: 353159

<...> is simply how IPython skips over values when a string would otherwise be too long. In IPython/core/oinspect.py:

    # String form, but snip if too long in ? form (full in ??)
    if detail_level >= self.str_detail_level:
        try:
            ostr = str(obj)
            str_head = 'string_form'
            if not detail_level and len(ostr)>string_max:
                ostr = ostr[:shalf] + ' <...> ' + ostr[-shalf:]
                ostr = ("\n" + " " * len(str_head.expandtabs())).\
                        join(q.strip() for q in ostr.split("\n"))
            out[str_head] = ostr
        except:
            pass

Upvotes: 3

Related Questions