-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Could tqdm default to redirecting std{out,err} to tqdm.write? #296
Comments
I don't think that's a good idea, libraries should never mess with the So we can provide code snippets but i don't think it's wise to implement
|
Doesn't the example provided in the "redirecting writing" section of tqdm.github.io cover all the cases that you suggest? Please let me know if there are any specific counter-examples. |
No because for example you have to use a different wrapper if you want to redirect logging module output. I don't think there is a way to allow for generic redirection, this is a per application need... |
No, I find it a bit funny that I need to be claiming that your code is has more capabilities than what you believe, but let's play a game: assume that the |
It's not that I doubt tqdm's capabilities, but rather that I fear automatic output redirection. We don't want tqdm to mess with parent apps, and output redirection is generally a big mess, so my opinion is that we should avoid providing an automated way to do that. But that's just my opinion... |
What about providing a kwarg to |
I'd really like to see this implement, either as an option or via a tqdm provided context manager. Personally, I'd prefer the option suggested by @anntzer because I am a lazy dev. 😄 I think tqdm provided context manager would also be an acceptable compromise. Something that basically implements the example given in the README.
I can put together a PR if there is interest in this. What do you think? |
I don't think it ever makes sense to
print
to the default stdout when in a tqdm loop (I may be wrong?), so perhaps it would make sense to default to enabling the writing redirection (with a kwarg to opt-out)?The text was updated successfully, but these errors were encountered: