Open bkamins opened 2 years ago
Maybe we could change describe(x)
to return an object that supports show
, but keep describe(io, x) = show(io, describe(x))
to limit breakage? How likely is it that somebody would rely on describe(x)
printing the result directly to stdout
, without ever printing the resulting object (which is currently nothing
)?
I agree that having describe(x)
return nothing
is not useful at all and kind of anti-pattern. I think this kind of behavior should be restricted to functions like print
, show
etc. whose only purpose is printing things (and I would not extend this list with describe
).
Currently
describe
contract is that it does pretty print the passed object. The contract does not say what the function returns. I propose thatdescribe
should keep to print what it promises, but also return the computed statistics.The crucial problem is that in REPL this would "double print" the contents. Also there is a duplication between
describe
andsummarystats
.I am not sure what is best, but I leave this issue open to keep track of it.
CC @nalimilan