Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #97463 > unrolled thread
| Started by | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| First post | 2015-10-07 10:23 +1100 |
| Last post | 2015-10-07 10:23 +1100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Python 2 ‘print’, coercing arguments to Unicode Ben Finney <ben+python@benfinney.id.au> - 2015-10-07 10:23 +1100
| From | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| Date | 2015-10-07 10:23 +1100 |
| Subject | Re: Python 2 ‘print’, coercing arguments to Unicode |
| Message-ID | <mailman.439.1444173810.28679.python-list@python.org> |
Peter Otten <__peter__@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
Back to top | Article view | comp.lang.python
csiph-web