Skip to content
New issue

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

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

Already on GitHub? # to your account

Add show to TBLogger object #31

Merged
merged 2 commits into from
Jun 3, 2019
Merged

Add show to TBLogger object #31

merged 2 commits into from
Jun 3, 2019

Conversation

PhilipVinc
Copy link
Member

Added a show method to TBLogger

@codecov

This comment has been minimized.

@oxinabox
Copy link
Member

I beleive you have defined these backwards.

  • show should be parsable julia code (like what you have defined print) to be.
  • print can be human readable description of thing (like what you have defined show to be)

See discussion in JuliaLang/julia#30757

@PhilipVinc
Copy link
Member Author

Thanks for the clarifying issue, I always had some confusion among those...

If I got it right, I should only declare a show(io, ::TBLogger) returning valid Julia code and a
show(io, mime::MIME"text/plain", ::TBLogger) printing the pretty stuff. I should not declare print.

@oxinabox
Copy link
Member

maybe?

@PhilipVinc
Copy link
Member Author

At least, according to the docs in the current master, print should be overloaded only if you want a minimal representation. I'm not sure what a minimal representation would be, so for the moment I would keep it like that.

https://docs.julialang.org/en/v1.3-dev/manual/types/#man-custom-pretty-printing-1

and to this comment

  • minimal/canonical representation: print. string gives a string of its output.
  • parseable (if possible) representation of any value: show(io, x). repr(x) gives a string of its output.
  • pretty display format for any value: show(io, mime, x). repr(mime, x) gives a string of its output.

If there are no objections I'll merge this.

@oxinabox
Copy link
Member

oxinabox commented Jun 3, 2019

sounds right to me

@PhilipVinc PhilipVinc merged commit ddfa9a7 into master Jun 3, 2019
@PhilipVinc PhilipVinc deleted the philipvinc/prettyprint branch June 3, 2019 13:38
shashikdm pushed a commit to shashikdm/TensorBoardLogger.jl that referenced this pull request Jun 4, 2019
Add pretty-printing to `TBLogger` object
shashikdm pushed a commit to shashikdm/TensorBoardLogger.jl that referenced this pull request Jun 4, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants