# Can I disable overloaded Base.show() and print the raw form of an object?

**URL:** <https://discourse.julialang.org/t/can-i-disable-overloaded-base-show-and-print-the-raw-form-of-an-object/68286>\
**Category:** General Usage\
**Tags:** show\
**Created:** [September 16, 2021, 8:45pm UTC](https://discourse.julialang.org/t/can-i-disable-overloaded-base-show-and-print-the-raw-form-of-an-object/68286 "2021-09-16T20:45:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![greatpet](https://avatars.discourse-cdn.com/v4/letter/g/e495f1/32.png) [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Post date:** [September 16, 2021, 8:45pm UTC](https://discourse.julialang.org/t/can-i-disable-overloaded-base-show-and-print-the-raw-form-of-an-object/68286/1 "2021-09-16T20:45:37Z")

</div>

Sometimes I’d like to see the “raw” form of a custom struct. Can I print it using the default Base.show(), ignoring my own custom definitions which print prettier results but may hide details useful for debugging?

---

<div class="post-metadata">

**Author:** ![cjdoris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cjdoris/32/213133_2.png) [@cjdoris](https://discourse.julialang.org/u/cjdoris)\
**Post date:** [September 16, 2021, 9:07pm UTC](https://discourse.julialang.org/t/can-i-disable-overloaded-base-show-and-print-the-raw-form-of-an-object/68286/2 "2021-09-16T21:07:06Z")

</div>

I think you want the `dump` function.

---

<div class="post-metadata">

**Author:** ![greatpet](https://avatars.discourse-cdn.com/v4/letter/g/e495f1/32.png) [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Post date:** [September 16, 2021, 9:46pm UTC](https://discourse.julialang.org/t/can-i-disable-overloaded-base-show-and-print-the-raw-form-of-an-object/68286/3 "2021-09-16T21:46:00Z")

</div>

Sometimes `dump` works, but when my struct contains nontrivial data structures like `Dict`, I’ll get lengthy unreadable results, because literally all the subfields are dumped. I just want to temporarily disable my overloaded version of `Base.show`, but maybe there’s just no good way to do that.

---

<div class="post-metadata">

**Author:** ![CameronBieganek](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cameronbieganek/32/6915_2.png) [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Post date:** [September 16, 2021, 9:58pm UTC](https://discourse.julialang.org/t/can-i-disable-overloaded-base-show-and-print-the-raw-form-of-an-object/68286/4 "2021-09-16T21:58:29Z")

</div>

You can use the `maxdepth` keyword argument to control how deeply `dump` prints:

```julia
struct A{S, T}
    x::S
    y::T
end

a = A(1:4, Dict(:a => 1, :b => 2));

```

```julia
julia> dump(a; maxdepth=1)
A{UnitRange{Int64}, Dict{Symbol, Int64}}
  x: UnitRange{Int64}
  y: Dict{Symbol, Int64}

```

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [September 17, 2021, 12:37am UTC](https://discourse.julialang.org/t/can-i-disable-overloaded-base-show-and-print-the-raw-form-of-an-object/68286/5 "2021-09-17T00:37:37Z")

</div>

> [@greatpet](#):
>
> Can I print it using the default Base.show(), ignoring my own custom definitions which print prettier results but may hide details useful for debugging?

You can use `invoke(show, Tuple{IO,Any}, stdout, x)` to invoke the default `show(::IO, ::Any)` method instead of any overloaded definition for `x`:

```julia
julia> invoke(show, Tuple{IO,Any}, stdout, pi)
Irrational{:π}()

```

Alternatively, you can call `Base.show_default(io, x)` (which happens to be what `show(::IO, ::Any)` calls), but `invoke` is the more general technique to call a less-specific method.
