# Itent of \`Base.summary\` function

**URL:** https://discourse.julialang.org/t/itent-of-base-summary-function/24323
**Category:** General Usage
**Created:** [May 17, 2019, 1:49pm UTC](https://discourse.julialang.org/t/itent-of-base-summary-function/24323 "2019-05-17T13:49:17Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![cce](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cce/32/460_2.png) [@cce](https://discourse.julialang.org/u/cce)
#### Post date: [May 17, 2019, 1:49pm UTC](https://discourse.julialang.org/t/itent-of-base-summary-function/24323/1 "2019-05-17T13:49:17Z")

</div>

I’m curious, how is `summary` meant to be used? From the description, I get that `summary` should parrot the type information and the size of the object, but not the actual data. This seems quite useful, as a complement to `dump`. How are we expecting people to use `summary`?

> Print to a stream io, or return a string str, giving a brief description of a value. By default returns string(typeof(x)), e.g. Int64. For arrays, returns a string of size and type info, e.g. 10-element Array{Int64,1}.

```julia
  julia> summary(zeros(2))
  "2-element Array{Float64,1}"

```

Specific questions: a) it seems that the summary output is limited to a single line, is this a necessary constraint? b) are the actual lengths of the variables needed, this would make it specific to an instance of an object, and while that’s handy it means you’ve got to peek into the actual object, c) it seems that the actual type is to be included, is this implied/required?

It seems that `DataFrame` has a `summary` implementation. However, unlike the summary of a vector, it doesn’t include the types of its elements – but it does include the size of the table.

```julia
julia> summary(DataFrame(a=[1,2],b=["A","B"]))
"2×2 DataFrame"

```

Thank you for any advice/thoughts.

---

<div class="post-metadata">

### Author: ![jeff.bezanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeff.bezanson/32/48_2.png) [@jeff.bezanson](https://discourse.julialang.org/u/jeff.bezanson)
#### Post date: [May 17, 2019, 4:51pm UTC](https://discourse.julialang.org/t/itent-of-base-summary-function/24323/2 "2019-05-17T16:51:02Z")

</div>

`summary` is supposed to be one line, for inclusion in output like `varinfo()` where you just want a brief description of a value. Other than that I don’t think there are any requirements; it can be whatever is an appropriate compact description.
