>>>>>>> * Print is now a function. Great, much improvement. >>>>> Actually not, IMHO. All it does is is to provide incompatibility. >>>> >>>> What incompatibility are you exactly talking about? >>>> >>>> Python 2.6.2 (r262:71600, Aug 21 2009, 12:23:57) >>>> [GCC 4.4.1 20090818 (Red Hat 4.4.1-6)] on linux2 >>>> Type "help", "copyright", "credits" or "license" for more information. >>>>>>> print( 'hello' ) >>>> hello >>>>>>> print 'hello' >>>> hello >>>> >>>> Yes, this is with python 2.6.2 which is in the 2.x line of releases. So? >>> I gather that your example is about code that technically executes fine >>> with >>> both versions and produces the same result, i.e. that there is a subset >>> with >>> the >>> same syntax and semantics. >>> >>> But 'print' calls that technically execute fine with both versions may >>> and >>> will >>> in general produce different results. >>> >>> I.e. not just the syntax but also the semantics have changed: >>> >>> >>> >>> import sys >>> >>> sys.version >>> '2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)]' >>> >>> >>> >>> print( "2+2 =", 2+2 ) >>> ('2+2 =', 4) >>> >>> _ >>> >>> >>> >>> import sys >>> >>> sys.version >>> '3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit (Intel)]' >>> >>> >>> >>> print( "2+2 =", 2+2 ) >>> 2+2 = 4 >>> >>> _ >> >> True. However, as someone else pointed out in a neighbouring thread you >> can do >> >> Python 2.6.2 (r262:71600, Aug 21 2009, 12:23:57) >> [GCC 4.4.1 20090818 (Red Hat 4.4.1-6)] on linux2 >> Type "help", "copyright", "credits" or "license" for more information. >>>>> from __future__ import print_function >>>>> print( "2+2 =", 2+2 ) >> 2+2 = 4 >> >> which gives 100% compatibility as far as print is concerned between 2.6 >> and 3.x. > > That makes the code behave with 3.x syntax and semantics regarding print. > I.e. it chooses one language. > > It doesn't make them compatible:
Of course it makes them compatible. I'm not saying any print-related code in python 2.6 is valid python 3 code, but that it is *possible* to write print-related code in python 2.6 that is also valid in python 3. > if they were, then you wouldn't have to choose. It seems to me you are arguing with the statement "Any print-related python 2.6 code is valid python 3 code". Nobody is making this statement. Let me repeat, what you should be arguing with is "It is possible to write print-related python 2.6 code that is also valid python 3 code". Perhaps I didn't make myself clear before, but at least now I hope it's clear what I mean. Cheers, Daniel > For example, it doesn't fix up 2.x code that prints tuples: incompatible, it > will still execute but no longer do what it was supposed to do. > > But lest you focus down on that rare case, consider 2.x code that contains > > print "2+2", 2 > > All such statements need to be fixed up in a 2->3 transition. Adding > __future__ > just makes the code invalid, it doesn't give you any shred of compatibility > for > this. A code rewrite can be partially automated like 2to3 but the > incompatibility needlessly introduces an additional set of things that Can > Go > Wrong(TM), and with Murphy present, as He always is, well. > > >> So again, what sort of an incompatibility are you talking about >> concerning 'print' between 2.6 and 3.x? > > Syntax and semantics. They're different. -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org/mailman/listinfo/python-list