Skip to content

Commit

Permalink
repr: update docstring for possible values of the context argument (J…
Browse files Browse the repository at this point in the history
  • Loading branch information
rfourquet committed Jun 8, 2021
1 parent 70771b2 commit 523dafe
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions base/strings/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -249,14 +249,18 @@ print(io::IO, s::Union{String,SubString{String}}) = (write(io, s); nothing)
Create a string from any value using the [`show`](@ref) function.
You should not add methods to `repr`; define a `show` method instead.
The optional keyword argument `context` can be set to an `IO` or [`IOContext`](@ref)
object whose attributes are used for the I/O stream passed to `show`.
The optional keyword argument `context` can be set to a `:key=>value` pair, a
tuple of `:key=>value` pairs, or an `IO` or [`IOContext`](@ref) object whose
attributes are used for the I/O stream passed to `show`.
Note that `repr(x)` is usually similar to how the value of `x` would
be entered in Julia. See also [`repr(MIME("text/plain"), x)`](@ref) to instead
return a "pretty-printed" version of `x` designed more for human consumption,
equivalent to the REPL display of `x`.
!!! compat "Julia 1.7"
Passing a tuple to keyword `context` requires Julia 1.7 or later.
# Examples
```jldoctest
julia> repr(1)
Expand Down

0 comments on commit 523dafe

Please sign in to comment.