Still useful to learn Python 2?

Contribute code & patches
Forum rules
No support questions here please

Still useful to learn Python 2?

Postby Arrow2Knee on Wed Dec 21, 2011 1:53 am

Hi guise,

I want to program and package for Linux (mostly Debian packages) and I learnt that Python is easy to program and package in Linux. So I want to learn Python.
I already have experience with C#, PHP and Java, but that doesn't matter for this topic. I have found a good book, for Python 2, but there is my question. The current installed Python version on this PC is 2.7, is it likely that Linux will update to Python 3 soon, so that it's useless that I learn Python 2. Or will it still stay for a while at 2?


Thanks already!
User avatar
Arrow2Knee
Level 2
Level 2
 
Posts: 83
Joined: Tue Dec 20, 2011 4:45 am
Location: Brussels, Belgium

Linux Mint is funded by ads and donations.
 

Re: Still useful to learn Python 2?

Postby nunol on Wed Dec 21, 2011 7:25 am

Python 2 is going to be with us for a while, Mint 13 LTS / Ubuntu 12.04 LTS is going to use Python 2 and is going to have support until 2017.

The Python site has a nice "Should I use Python 2 or Python 3 for my development activity?" page: http://wiki.python.org/moin/Python2orPython3
User avatar
nunol
Level 9
Level 9
 
Posts: 2664
Joined: Sun Mar 06, 2011 9:25 pm
Location: Portugal

Re: Still useful to learn Python 2?

Postby k357k9 on Wed Dec 21, 2011 7:46 am

YouTube might be able to help a little with http://www.youtube.com/watch?v=WT-gS-8p7KA .
k357k9
Level 3
Level 3
 
Posts: 102
Joined: Wed Mar 24, 2010 7:48 am
Location: Dallas, Texas

Re: Still useful to learn Python 2?

Postby overthetop on Wed Apr 18, 2012 10:39 am

Python 2 has many more modules and is better supported. If you learn Python 2, you should have no trouble with Python 3 (just read an article on the basic differences between 2 and 3). I learned Python 3 first, and it was great for personal use. It was a pain however for programs I wanted to distribute because of its lack of supporting 3rd party modules. While the scene is improving, Python 2 is still better for development of programs. Please note that Python 3 is not inferior to 2 in any way. It has many nice and improved features and is very stable. It just has less support because 2 was so good that many people do not see the need to move on yet.
Image
"A wise man can learn more from a foolish question than a fool can learn from a wise answer." -- Bruce Lee
User avatar
overthetop
Level 4
Level 4
 
Posts: 368
Joined: Thu Oct 06, 2011 10:25 am
Location: /home/overthetop

Re: Still useful to learn Python 2?

Postby xenopeek on Wed Apr 18, 2012 3:54 pm

overthetop wrote:It just has less support because 2 was so good that many people do not see the need to move on yet.

And that is why people don't move on, chick and egg problem. I'm using Python 3 for all my development, but not using that many 3rd party modules so perhaps if you want to go that way it is indeed the case that less modules support Python 2. Still, Python 3 has been around since 2008...

When a few years back I wanted to get into a more easy to use and maintain language, after using C, Perl and Ruby for years, I was quickly attuned to Python 3 being an improvement over Python 2 for my needs. Especially its Unicode handling is impressively improved from 2 to 3, so if you work with text a lot...
Forum Rules | IRC Channel Rules
Image
Arch Linux / 64-bit / Gnome Shell
User avatar
xenopeek
Level 21
Level 21
 
Posts: 13668
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Still useful to learn Python 2?

Postby BTPFMJ on Mon Apr 30, 2012 5:46 pm

I sometimes use Python (instead of Perl, bash scripts etc.) to create low level utilities and in those scenarios the changes in Unicode handling introduced in Python 3 are an annoyance at best and sometimes downright dangerous. It has improved a lot since the early releases, Python 3 no longer seems to silently discard (!) directory entries, environment variables etc. that don't fit the default character encoding (usually UTF-8), but if you want your program to be able to handle multiple or incorrect encodings, it's still going to be a pain. Also, not all modules that come with the language (not to mention third party modules) are robust in this area, for example on Linux it's impossible to open an SQLite database file whose path doesn't fit both the default encoding and UTF-8 at the same time.

For these reasons, as much as I like most of Python 3, I specifically avoid it for systems programming, and stick with Python 2 only. These considerations probably aren't important for most people but it's something to keep in mind.
BTPFMJ
Level 1
Level 1
 
Posts: 10
Joined: Fri Jun 04, 2010 11:22 am


Return to Code & Patches

Who is online

Users browsing this forum: No registered users and 0 guests