python 3's adoption

Alf P. Steinbach alfps at start.no
Wed Jan 27 09:57:14 EST 2010


* Daniel Fetchinson:
>>>>     * 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
 >>> _



Cheers & hth.,

- Alf



More information about the Python-list mailing list