Skip to content

Stop pirating show for NamedTuples #1018

@sethaxen

Description

@sethaxen

This line pirates show for NamedTuple.

Base.show(stream::IO, ::MIME"text/plain", t::NamedTuple) = fancy_nt(stream, t)

It differs from the existing show method in Base by inserting a newline:
https://github.com/JuliaLang/julia/blob/9375a2d9d758c8ad4fc0fbae1e36702e6aed0ada/base/namedtuple.jl#L198-L229

I ran into this when doctests for a function that returns a NamedTuple started to fail when MLJBase came into scope.

Quick demo:

julia> nt = (; x=3, y=4)
(x = 3, y = 4)

julia> using MLJBase

julia> nt
(x = 3,
 y = 4,)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions