Le 26/03/2017 à 10:31, Victor Stinner a écrit : > print(msg) calls sys.stdout.write(msg): write() expects text, not bytes.
What you are saying right now is that the API is not granular enough to just add a parameter. Not that it can't be done. It just mean we need to expose stdout.write() encoding behavior. > I dislike the idea of putting encoding options in print. It's too > specific. What if tomorrow you replace print() with file.write()? Do you > want to add errors there too? You would have to rewrite all your calls anyway, because print() call str() on things and accept already many parameters while file.write() doesn't. > > No, it's better to write own formatter function as shown in a previous > email. print(encoding) is short, easy to use, unobtrusive and will be used ponctually. How is that using your own formatter function better ? _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/