-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Open
Labels
display and printingAesthetics and correctness of printed representations of objects.Aesthetics and correctness of printed representations of objects.keyword argumentsf(x; keyword=arguments)f(x; keyword=arguments)performanceMust go fasterMust go faster
Description
IOContext already accepts Vararg{Pair{Symbol}}. The following code seems to work just fine.
> julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.8.2 (2022-09-29)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> Base.IOContext(io; kwargs...) = if length(kwargs) > 0
IOContext(io, kwargs...)
else
convert(IOContext, io)
end
julia> IOContext(stdout)
IOContext(Base.TTY(RawFD(13) open, 0 bytes waiting))
julia> io = IOContext(stdout)
IOContext(Base.TTY(RawFD(13) open, 0 bytes waiting))
julia> printstyled(io, rand())
0.39622936715782087
julia> io = IOContext(stdout; compact=true)
IOContext(Base.TTY(RawFD(13) open, 0 bytes waiting))
julia> printstyled(io, rand(), color=:red)
0.0857637
I can open a PR if there is interest.
LilithHafner, o314 and jakobjpeters
Metadata
Metadata
Assignees
Labels
display and printingAesthetics and correctness of printed representations of objects.Aesthetics and correctness of printed representations of objects.keyword argumentsf(x; keyword=arguments)f(x; keyword=arguments)performanceMust go fasterMust go faster