Beginner needs advice

Thomas Rachel nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915 at spamschutz.glglgl.de
Sat May 28 01:06:53 EDT 2011


Am 27.05.2011 17:52 schrieb Steven D'Aprano:
> On Fri, 27 May 2011 09:40:53 -0500, harrismh777 wrote:
>
>> 3.x is completely incompatible with 2.x (some call it a dialect,
>> but that is a lie).
>
> "Completely incompatible"? A "lie"?

Hard word, but it is true. Many things can and will fall on your feet 
when moving.

There are very many subtle differences.


> import math
> import random
> my_list = [3, 5, 7, 9]
> n = random.choice(my_list)
> if n%3:
>      func = math.sin
> else:
>      func = math.cos
>
> y = func(math.pi/n)*10
> L = ['spam']*(int(y))
> for item in L:
>      print(item)
>
>
> is valid syntax in every version of Python from 1.5 to 3.2, and it does
> the same thing in all of them.

C and C++ guys complain if these languages are intermixed. Even there it 
is possible to write a program which is valid in both of them. 
Nevertheless, they are two different languages.

So are Py2 and Py3, IMHO.


Thomas



More information about the Python-list mailing list