Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change describe contract #43

Open
bkamins opened this issue Nov 30, 2021 · 2 comments
Open

Change describe contract #43

bkamins opened this issue Nov 30, 2021 · 2 comments

Comments

@bkamins
Copy link
Member

bkamins commented Nov 30, 2021

Currently describe contract is that it does pretty print the passed object.
The contract does not say what the function returns. I propose that describe 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 and summarystats.

I am not sure what is best, but I leave this issue open to keep track of it.

CC @nalimilan

@nalimilan
Copy link
Member

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)?

@bkamins
Copy link
Member Author

bkamins commented Dec 4, 2021

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants