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 verbose_print #485

Closed
wants to merge 3 commits into from
Closed

Conversation

tburrows13
Copy link
Collaborator

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 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.
@tburrows13 tburrows13 changed the title Changed verbose_print Change verbose_print Mar 12, 2017
@Zulko
Copy link
Owner

Zulko commented Mar 12, 2017

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.

@coveralls
Copy link

coveralls commented Mar 12, 2017

Coverage Status

Coverage decreased (-0.3%) to 39.109% when pulling eba9d76 on Gloin1313-change-verbose_print into c97a0b7 on master.

@tburrows13
Copy link
Collaborator Author

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

@ghost
Copy link

ghost commented Mar 13, 2017

@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!

@tburrows13
Copy link
Collaborator Author

Yep, will do!

@tburrows13 tburrows13 closed this Mar 28, 2017
@tburrows13 tburrows13 deleted the Gloin1313-change-verbose_print branch March 28, 2017 18:05
tburrows13 pushed a commit that referenced this pull request Mar 28, 2017
@tburrows13 tburrows13 mentioned this pull request Mar 28, 2017
@tburrows13
Copy link
Collaborator Author

Done in #514

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

Successfully merging this pull request may close these issues.

3 participants