From: geremy condra on
On Mon, Jun 28, 2010 at 1:08 PM, Edward A. Falk <falk(a)green.rahul.net> wrote:
> In article <mailman.2270.1277736664.32709.python-list(a)python.org>,
> Stephen Hansen  <me+list/python(a)ixokai.io> wrote:
>>
>>No one said otherwise, or that print was useless and never used in such
>>contexts.
>
> I was responding to the question "Also, do you use print *that*
> much? Really?"  The implication being that in the majority of useful
> python programs, you don't really need to use print.
>
> My answer is yes, I use print in 100% of the scripts I write, including
> the large useful ones.
>
> For this reason alone, python 3 is incompatible with python 2 (which
> has already been acknowledged.)
>
> Until such time as 100% of the systems I might ever want to run my progams
> on have python 3 installed, I cannot port my programs over from python 2.

Uhmm, just add the parenthesis to your old scripts. You can
do that without breaking on 2.x.

Geremy Condra
From: Stephen Hansen on
On 6/28/10 1:30 PM, geremy condra wrote:
> On Mon, Jun 28, 2010 at 1:08 PM, Edward A. Falk<falk(a)green.rahul.net> wrote:
>> In article<mailman.2270.1277736664.32709.python-list(a)python.org>,
>> Stephen Hansen<me+list/python(a)ixokai.io> wrote:
>>>
>>> No one said otherwise, or that print was useless and never used in such
>>> contexts.
>>
>> I was responding to the question "Also, do you use print *that*
>> much? Really?" The implication being that in the majority of useful
>> python programs, you don't really need to use print.
>>
>> My answer is yes, I use print in 100% of the scripts I write, including
>> the large useful ones.
>>
>> For this reason alone, python 3 is incompatible with python 2 (which
>> has already been acknowledged.)
>>
>> Until such time as 100% of the systems I might ever want to run my progams
>> on have python 3 installed, I cannot port my programs over from python 2.
>
> Uhmm, just add the parenthesis to your old scripts. You can
> do that without breaking on 2.x.

Only sort of. But in Python 2.6+, you only need to "from __future__
import print_function" to make code work in both 2.x and 3.x (at least
insofar as the print situation is concerned).

--

... Stephen Hansen
... Also: Ixokai
... Mail: me+list/python (AT) ixokai (DOT) io
... Blog: http://meh.ixokai.io/

From: Grant Edwards on
On 2010-06-28, geremy condra <debatem1(a)gmail.com> wrote:
> On Mon, Jun 28, 2010 at 1:08 PM, Edward A. Falk <falk(a)green.rahul.net> wrote:
>> In article <mailman.2270.1277736664.32709.python-list(a)python.org>,
>> Stephen Hansen ?<me+list/python(a)ixokai.io> wrote:
>>>
>>>No one said otherwise, or that print was useless and never used in such
>>>contexts.
>>
>> I was responding to the question "Also, do you use print *that*
>> much? Really?" ?The implication being that in the majority of useful
>> python programs, you don't really need to use print.
>>
>> My answer is yes, I use print in 100% of the scripts I write, including
>> the large useful ones.
>>
>> For this reason alone, python 3 is incompatible with python 2 (which
>> has already been acknowledged.)
>>
>> Until such time as 100% of the systems I might ever want to run my progams
>> on have python 3 installed, I cannot port my programs over from python 2.
>
> Uhmm, just add the parenthesis to your old scripts. You can
> do that without breaking on 2.x.

I suppose so, for some values of "breaking". It can change the output:

There is definitely a semantic difference between

print "asdf",

and
print ("asdf",)

--
Grant Edwards grant.b.edwards Yow! Those people look
at exactly like Donnie and
gmail.com Marie Osmond!!
From: Robert Kern on
On 6/28/10 3:09 PM, Edward A. Falk wrote:
> In article<mailman.2268.1277736080.32709.python-list(a)python.org>,
> Stephen Hansen<me+list/python(a)ixokai.io> wrote:
>>
>> Any other use, I basically operate on a file object.
>
> I use file objects all the time. I use print with them.

The 2to3 conversion script takes care of this for you.

[~]$ 2to3 foo.py
RefactoringTool: Skipping implicit fixer: buffer
RefactoringTool: Skipping implicit fixer: idioms
RefactoringTool: Skipping implicit fixer: set_literal
RefactoringTool: Skipping implicit fixer: ws_comma
--- foo.py (original)
+++ foo.py (refactored)
@@ -1,3 +1,3 @@
import sys

-print >>sys.stderr, "Error!"
+print("Error!", file=sys.stderr)
RefactoringTool: Files that need to be modified:
RefactoringTool: foo.py

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

From: geremy condra on
On Mon, Jun 28, 2010 at 1:52 PM, Grant Edwards <invalid(a)invalid.invalid> wrote:
> On 2010-06-28, geremy condra <debatem1(a)gmail.com> wrote:
>> On Mon, Jun 28, 2010 at 1:08 PM, Edward A. Falk <falk(a)green.rahul.net> wrote:
>>> In article <mailman.2270.1277736664.32709.python-list(a)python.org>,
>>> Stephen Hansen ?<me+list/python(a)ixokai.io> wrote:
>>>>
>>>>No one said otherwise, or that print was useless and never used in such
>>>>contexts.
>>>
>>> I was responding to the question "Also, do you use print *that*
>>> much? Really?" ?The implication being that in the majority of useful
>>> python programs, you don't really need to use print.
>>>
>>> My answer is yes, I use print in 100% of the scripts I write, including
>>> the large useful ones.
>>>
>>> For this reason alone, python 3 is incompatible with python 2 (which
>>> has already been acknowledged.)
>>>
>>> Until such time as 100% of the systems I might ever want to run my progams
>>> on have python 3 installed, I cannot port my programs over from python 2.
>>
>> Uhmm, just add the parenthesis to your old scripts. You can
>> do that without breaking on 2.x.
>
> I suppose so, for some values of "breaking".  It can change the output:
>
> There is definitely a semantic difference between
>
>   print "asdf",
>
> and
>   print ("asdf",)

I was actually referring to what stephen hansen pointed out, the
from __future__ import print_function.

Geremy Condra