-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 verbose_print
#485
Change verbose_print
#485
Conversation
I don't see why we need the fancy `sys.stout` when `print` prints to `stout` by default, and flushes automatically. This also means we can use `verbose_print` just like `print` except with the `verbose` parameter before anything to be printed. e.g. `verbose_print(True, var1, var2) which would have failed with the old `verbose_print`. I tried to use `verbose_print` in my application, but acted very weirdly, hence the change.
I should have documented this one, but basically the issue was that in some consoles (and in the IPython notebook, at least at the time), "print" commands get delayed, while stdout.flush are instantaneous, so my method was better at providing feedback. I would be against changing it to print unless it solves some known issues. |
I posted this as a question on Stack Overflow here: http://stackoverflow.com/questions/42752218/does-print-delay-in-some-consoles-where-stdout-flush-doesnt |
@Gloin1313 do you think you can add @Zulko 's comment in the source code so that if someone tries to change this (like you did), we have an explanation of why it needs to stay as is? Thanks! |
Yep, will do! |
Done in #514 |
I don't see why we need the fancy
sys.stout
whenprint
prints tostout
by default, and flushes automatically. This also means we can useverbose_print
just likeprint
except with theverbose
parameter before anything to be printed. e.g.verbose_print(True, var1, var2) which would have failed with the old
verbose_print`.I tried to use
verbose_print
in my application, but acted very weirdly, hence the change.