AnotherToothbrush
Posts: 3
Joined: Mon Mar 05, 2012 6:35 pm

Re: Should I learn python 2 or python 3?

Mon Mar 05, 2012 6:42 pm

After rooting around on the Internet for a while I"ve seen loads of tutorials for python 2 and python 3 but which one will come with the Raspberry Pi itself? It"s just I want to give myself a head start before I get it

User avatar
croston
Posts: 716
Joined: Sat Nov 26, 2011 12:33 pm
Location: Blackpool
Contact: Website

Re: Should I learn python 2 or python 3?

Mon Mar 05, 2012 6:46 pm

There is very little difference between Python 2 and 3. I suggest you go with python 3 as it is the way forward for python as a language.

AnotherToothbrush
Posts: 3
Joined: Mon Mar 05, 2012 6:35 pm

Re: Should I learn python 2 or python 3?

Mon Mar 05, 2012 6:49 pm

Thanks I"ll get started then

hron
Posts: 2
Joined: Mon Mar 05, 2012 8:22 pm

Re: Should I learn python 2 or python 3?

Mon Mar 05, 2012 8:34 pm

AnotherToothbrush said:


Thanks I"ll get started then




AnotherToothbrush said:


After rooting around on the Internet for a while I"ve seen loads of tutorials for python 2 and python 3 but which one will come with the Raspberry Pi itself? It"s just I want to give myself a head start before I get it



Hi, I am a starter too. I decided to start wit version 2 since I am very intersted in the library scipy and numpy for math and scientific applications. These are not available in version 3 yet.

Have a look at this book here:

http://www.itmaybeahack.com/ho.....ython.html

It is free, teaches version 2 and gives hints what will change with version 3, very good approach.

hron
Posts: 2
Joined: Mon Mar 05, 2012 8:22 pm

Re: Should I learn python 2 or python 3?

Mon Mar 05, 2012 8:34 pm

Hi, I am a starter too. I decided to start wit version 2 since I am very intersted in the library scipy and numpy for math and scientific applications. These are not available in version 3 yet.

Have a look at this book here:

http://www.itmaybeahack.com/ho.....ython.html

It is free, teaches version 2 and gives hints what will change with version 3, very good approach.

dextrus
Posts: 119
Joined: Tue Jan 24, 2012 10:10 pm
Location: Eastleigh, Hampshire
Contact: Website

Re: Should I learn python 2 or python 3?

Mon Mar 05, 2012 10:06 pm

This isn't an easy question to answer. The basics though are:

Go with Python 3 if you just want to learn the language and aren't interested in doing anything "serious". Why? Because a lot of the key libraries for doing "cool" stuff haven't been converted to Python 3 yet.

This brings a dilemma though, as you will soon find that you want to use external libraries.

The easy solution though is to install both. For instance I have Python 2.7 and Python 3.2 and they install in separate directories. Some packages/libraries will look for the version of Python they need but some don't. In this case, if you're knowledgeable about what the PATH environment variable is, you can force the use of one or the other by removing the one you don't need from the PATH.

Final answer? Install both.
Have more FUN with your Pi. Visit www.pi-fun.com

dashby
Posts: 6
Joined: Sun May 20, 2012 10:56 am

Re: Should I learn python 2 or python 3?

Sun May 20, 2012 10:59 am

Although the answers given here make sense they do not answer the original question, which version will the raspberry Pi have on board? I have just started to learn 3.2.3 but if I get the Pi and find that it is running with version 2.xx then there are quite a few differences between the versions.

Does anyone know what version of Python will be on the Pi?

User avatar
nick.mccloud
Posts: 830
Joined: Sat Feb 04, 2012 4:18 pm

Re: Should I learn python 2 or python 3?

Sun May 20, 2012 11:33 am

AFAIK, the educational release will use Python 3 but it's just Linux, you can install either or both with just one command and then use either or both as you want/feel/need.

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4257
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: Should I learn python 2 or python 3?

Sun May 20, 2012 11:37 am

It's ben said before on here that Python 3 should be used for teaching, because in the next year or two it will be the standard, but Python 2 should be used for learning because many libraries have not yet been ported.

You can write the Python 3 code under Python 2 if your file begins with the line:

Code: Select all

from __future__ import absolute_import, division, generators, unicode_literals, print_function, nested_scopes, with_statement
With that line in place, your code will work with either Python 2 or Python 3. There may be rare cases in which it doesn't work, but I have not found any,

User avatar
stevepdp
Posts: 285
Joined: Fri Oct 28, 2011 7:41 am
Contact: Website Twitter

Re: Should I learn python 2 or python 3?

Sun May 20, 2012 11:43 am

dashby wrote:which version will the raspberry Pi have on board?
Well, bare in mind that there are multiple distributions of GNU/Linux available for the Pi so the Python version may vary between them...

The Debian build, which is the recommended distro currently, contains 2.6.6. But of course Python 3 can be installed separately as has been suggested already.

An interesting thing to note is that the Raspberry Filling project will be documenting Python 3. See the post here which discusses it.

So I guess it's undecided at the moment. The Python situation will likely become clearer as it nears the educational launch.

Return to “Python”