Python 2 ‘print’, coercing arguments to Unicode
Ben Finney
ben+python at benfinney.id.au
Tue Oct 6 19:23:16 EDT 2015
Peter Otten <__peter__ at web.de> writes:
> Have a look at PyFile_WriteObject in Objects/fileobject.c.
> As I understand the code it basically does
>
> if isinstance(obj) and stream.encoding is not None:
> s = obj.encode(stream.encoding))
> else:
> s = str(obj)
> stream.write(s)
So as I understand it I'm looking for the hypothetical
from __future__ import print_coerce_args_to_unicode
and without that, I'm stuck with the hard-coded ‘str’ coercion.
Thanks, at least now I can stop flailing to try to get it working.
--
\ “Fear him, which after he hath killed hath power to cast into |
`\ hell; yea, I say unto you, Fear him.” –Jesus, as quoted in Luke |
_o__) 12:5 |
Ben Finney
More information about the Python-list
mailing list