You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Library should not be printing to stdout without verbose option #6929
I think it's good policy not to print anything to standard output in library code, except when that's specified by the API, e.g. through a verbose parameter. We have, for instance, a few unguarded print calls in sklearn/datasets. These should be weeded out. One option for fixing is to use logging.info; another is to use print(..., file=sys.stderr).
It seems this is still open. One possibility to deal with users expecting prints to stdout is to append all existing prints with a deprecation warning, mentioning that in a next 1.x version the prints would be taken out and the user might adjust the verbose parameter (or whatever the other solution is).
Activity
Use logging.info instead of print (scikit-learn#6929)
fasiabbu commentedon Jun 24, 2016
Hi,
I see there are still a lot of places where print is being used. I presume all this should converted to logging.info. Is anybody working on this?
lesteve commentedon Jun 24, 2016
@fasiabbu somebody is already working on this, look at the PR above i.e. #6930.
amueller commentedon Oct 13, 2016
somewhat related #78
mitar commentedon Jul 4, 2018
I would also prefer if all output would go through Python logging.
jnothman commentedon Jul 4, 2018
Yes, this could do with some love. One concern is that we're not sure how to manage backwards compatibility.
mitar commentedon Jul 4, 2018
Backwards compatibility being going to
warnandprint, or even the formatting of what has been printed out?jnothman commentedon Jul 4, 2018
dkgaraujo commentedon May 26, 2022
It seems this is still open. One possibility to deal with users expecting prints to stdout is to append all existing prints with a deprecation warning, mentioning that in a next 1.x version the prints would be taken out and the user might adjust the
verboseparameter (or whatever the other solution is).adrinjalali commentedon Apr 19, 2024
Closing as duplicate of #78