Ben Finney wrote:
> Ben Finney writes:
>
>> In Python 2.7, I am seeing this behaviour for ‘print’::
>>
>> Python 2.7.10 (default, Sep 13 2015, 20:30:50)
>> [GCC 5.2.1 20150911] on linux2
>> Type "help", "copyright", "credits" or "license" for more
>>
Laura Creighton writes:
> Hmm, now that I read the six document again
> @six.python_2_unicode_compatible
Peter Otten <__pete...@web.de> writes:
> I don't think this is possible with the print statement, but the
> print() function can be replaced with anything you like:
Howdy all,
In Python 2.7, I am seeing this behaviour for ‘print’::
Python 2.7.10 (default, Sep 13 2015, 20:30:50)
[GCC 5.2.1 20150911] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from __future__ import unicode_literals
>>> from
Ben Finney wrote:
>> I don't think this is possible with the print statement, but the
>> print() function can be replaced with anything you like:
>
>
> Hmm. I am more looking for something that doesn't involve replacing
> ‘print’, but rather to hook into whatever it uses to coerce the type of
>
On 10/6/2015 6:45 AM, Ben Finney wrote:
Ben Finney writes:
How can I convince ‘print’, everywhere throughout a module, that it
should coerce its arguments using ‘unicode’?
Use Python 3. I am only half joking. Switching to unicode instead of
bytes as the
Terry Reedy writes:
> On 10/6/2015 6:45 AM, Ben Finney wrote:
> > Ben Finney writes:
>
> > How can I convince ‘print’, everywhere throughout a module, that it
> > should coerce its arguments using ‘unicode’?
>
> Use Python 3. I am only half joking.
Peter Otten <__pete...@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
Ben Finney writes:
> In Python 2.7, I am seeing this behaviour for ‘print’::
>
> Python 2.7.10 (default, Sep 13 2015, 20:30:50)
> [GCC 5.2.1 20150911] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> from
I think the thing you want to converse is your stringIO not your print.
I think you do this using six.stringIO
https://pythonhosted.org/six/
But I have only read the doc, not done this in practice.
Laura
--
https://mail.python.org/mailman/listinfo/python-list
Hmm, now that I read the six document again
@six.python_2_unicode_compatible
seems exactly what you are asking for ...
https://pythonhosted.org/six/
Laura
--
https://mail.python.org/mailman/listinfo/python-list
10 matches
Mail list logo