Python 2.6 OR 3.2

H

hisan

Hi All,

Please let me know which one is GOOD whether Python 2.6 OR 3.2.
Please let me know the difference between them.
Please give some refernce site or books to know the difference
 
J

John Gordon

In said:
Please let me know which one is GOOD whether Python 2.6 OR 3.2.
Please let me know the difference between them.
Please give some refernce site or books to know the difference

If you're starting new, use 3.2. All code will eventually move to this
newer style, so you'll have to learn it eventually.

The only reason to use 2.6 is if you have to maintain an existing code
base that was written with 2.6 (or older).
 
C

Corey Richardson

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi All,

Please let me know which one is GOOD whether Python 2.6 OR 3.2.
Please let me know the difference between them.
Please give some refernce site or books to know the difference

http://wiki.python.org/moin/Python2orPython3

Pick one and learn it well. It'll be easy to switch to the other when/if
you need to. Right now lots of nice libraries only support 2.x, like
Twisted and lots of web frameworks (all? I think there's one or two that
use 3).

- --
Corey Richardson
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)

iQEcBAEBAgAGBQJN8SDNAAoJEAFAbo/KNFvpbewH/3IclMl/K5d35qsVesoYuICB
pFt0W6gxyMSRMU2TcoYbpsSVlqjc+KCwUQ7wxv/yIw8ldXs09IV3ITbajKDR2Gnh
TX5DdgRaC8vAoQHLuvjUvJST0/1INnK/sYGnzS1xuNv5uuohqZ026jx4HEXTfjUi
haI/bFLELM9iKrBjuSRKYVy4RYRHAE0ziKblbXtfNTltU0Y2C56xRKkMplsEk/pV
ka+6R5OkHvMap+g++TRaXqN347m60GnWKWYwTklcTSyfJmmEtaokE4gJwPodv7N4
ozQrkcNdL3tHxTLFbMfO5zrSrW+yWEpsGRYbUSJIx8zOUOhbyjZJtHBuYu+xsqI=
=4AvK
-----END PGP SIGNATURE-----
 
C

Chris Angelico

Hi All,

Please let me know which one is GOOD whether Python 2.6 OR 3.2.

As a side point, you should probably use 2.7 rather than 2.6. With
regard to 2.x versus 3.x, Corey already posted a link to an excellent
article.

Chris Angelico
 
K

Kyle T. Jones

John said:
If you're starting new, use 3.2. All code will eventually move to this
newer style, so you'll have to learn it eventually.

The only reason to use 2.6 is if you have to maintain an existing code
base that was written with 2.6 (or older).

Library support.

Cheers.
 
T

Terry Reedy

Library support.

I urge people who use 2.x only for library support to let library
authors that they would have preferred a 3.x compatible library. I have
library authors say "Why port when none of my users have asked for a port?"

A couple of years ago, users were people who were already programming
with 2.x. That is changing now.
 
A

Andrew Berg

Hi All,

Please let me know which one is GOOD whether Python 2.6 OR 3.2.
Please let me know the difference between them.
Please give some refernce site or books to know the difference
I'm just a beginner, but AFAICT, there are three reasons to learn Python 2:
- You will need to maintain or add features to a project that is written
in Python 2 and is not easily converted to Python 3.
- You have a project that absolutely depends on something that is
written in Python 2 and is not easily converted to Python 3.
- You are forced to use a 2.x version of the interpreter (e.g., your
employer wants you to create Python scripts that will run on their
server, which runs a 2.x version of the interpreter). In this case, you
should learn the exact version of the interpreter used (some features in
2.7 aren't available in e.g., 2.3).

If none of these apply to you, then 3.2 all the way. Everything is
moving to 3.x - don't use 2.x as a starting point if you don't have to.
 
H

harrismh777

Andrew said:
AFAICT, there are three reasons to learn Python 2:

... there is a fourth reason.

The linux distro you are using currently was customized with python 2.x

I ran into this problem this week in fact... on my HP g6 ubuntu notebook
running 10.04 lucid. It ships with the 2.6.5 interpreter. I installed
2.7.1 and 3.2 (from sources) and was working along happy as a clam until
I needed to configure a printer... and the config tools would not
function... some of them would not even open. Want to guess? Yup, the
config tools are (some of them) written in python 2.6-- and they don't
run in 2.7.1 nor 3.2 . :(

So, be careful. I have had to separate *all* of my python installs on
*every* one of my systems for this similar reason. The bottom line is if
the distro ships with 2.6 (minus the idle) chances are that the
interpreter is there *not* to advocate for python explicitly, but
because the interpreter is being used by the system somewhere. If you
install 2.7 or 3.2 you need to be careful to *not* interfere with the
default setup.

So, you will need to be able to use both. There is no getting around
it... but, I would start with 3.2 (seriously). Get 3.2 under your belt
and then when you need to, go back and deal with the 2.6 regression.

3.2 is better built, is more logically consistent (it really is, no
kidding), and has some new features that make it very attractive. The
down-side is that some (most) of the library support is still not there
for many projects. It will take some time, but it will happen.



kind regards,
m harris
 
B

Benjamin Kaplan

  ... there is a fourth reason.

The linux distro you are using currently was customized with python 2.x

I ran into this problem this week in fact... on my HP g6 ubuntu notebook
running 10.04 lucid. It ships with the 2.6.5 interpreter. I installed 2.7..1
and 3.2 (from sources) and was working along happy as a clam until I needed
to configure a printer... and the config tools would not function... someof
them would not even open.  Want to guess?  Yup, the config tools are (some
of them) written in python 2.6-- and they don't run in 2.7.1 nor 3.2  .  :(

So, be careful.  I have had to separate *all* of my python installs on
*every* one of my systems for this similar reason. The bottom line is if the
distro ships with 2.6 (minus the idle) chances are that the interpreter is
there *not* to advocate for python explicitly, but because the interpreter
is being used by the system somewhere. If you install 2.7 or 3.2 you needto
be careful to *not* interfere with the default setup.

So, you will need to be able to use both.  There is no getting around it...
but, I would start with 3.2 (seriously). Get 3.2 under your belt and then
when you need to, go back and deal with the 2.6 regression.

3.2 is better built, is more logically consistent (it really is, no
kidding), and has some new features that make it very attractive. The
down-side is that some (most) of the library support is still not there for
many projects.   It will take some time, but it will happen.

There's an altinstall make target that you're supposed to use in cases
like this. It won't make the /usr/local/bin/python symlink (or
whatever prefix you're using), just pythonx.y. This way, the programs
that depend on "python" referring to a specific version will still
continue to work and you can have your newer version. The Ubuntu
packages that depend on the system Python+ system installed packages
*should* be specifying /usr/bin/python specifically but as you can
see, they don't always do that.
 
S

Steven D'Aprano

So, be careful. I have had to separate *all* of my python installs on
*every* one of my systems for this similar reason. The bottom line is if
the distro ships with 2.6 (minus the idle) chances are that the
interpreter is there *not* to advocate for python explicitly, but
because the interpreter is being used by the system somewhere. If you
install 2.7 or 3.2 you need to be careful to *not* interfere with the
default setup.

Yes.

Never mess with the system Python unless you want to take full
responsibility for fixing the system when it breaks :)
 
C

Chris Angelico

To the OP I'd say: learn Python through 3.2. It's the best way
forward, for the sake of yourself and others. The only way more
modules can become 3k compatible is if more people use 3k.

I skipped 3.2 and went straight to 3.3a0 from hg, but that's because
I'm comfortable with compiling my own :)

ChrisA
 
G

geremy condra

  ... there is a fourth reason.

The linux distro you are using currently was customized with python 2.x

I ran into this problem this week in fact... on my HP g6 ubuntu notebook
running 10.04 lucid. It ships with the 2.6.5 interpreter. I installed 2.7..1
and 3.2 (from sources) and was working along happy as a clam until I needed
to configure a printer... and the config tools would not function... someof
them would not even open.  Want to guess?  Yup, the config tools are (some
of them) written in python 2.6-- and they don't run in 2.7.1 nor 3.2  .  :(

Just a note, Ubuntu 11.04 has 2.7 preinstalled.

Geremy Condra
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,142
Messages
2,570,818
Members
47,362
Latest member
eitamoro

Latest Threads

Top