On Sat, Nov 27, 2021 at 3:03 AM <eyalgr...@gmail.com> wrote:
>
> i wonder whether:
>
> from myutils import myprint as print
>
> or
>
> _print = print
> print = myprint
>
> is really the pythonic way?

Seems fine to me, what's unpythonic about it?

> my use case for multiple files on top of the stdout, is when using e.g. wandb 
> which is a popular ML dashboard and experiment logging platform. i want to 
> write my log file both the a local log.txt and to a second copy in the 
> temporary local wandb folder that later gets synced to the cloud. otherwise i 
> have to take care of copying over the file later including in cases of 
> exceptions. more generally: writing a log to both a local and a remote 
> location.
>

The other option would be to pipe your script through tee and do the
whole thing externally. That way, if something goes horribly wrong,
the output is still captured.

ChrisA
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/VW742E6QADI2UH76NAOFKTI4GI7C3757/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to