As others already noted, bare sudo apt-get install package
will install latest available version, replacing the older one if needed.
But with some software (among which is Python) the situation is somewhat different. Some major, very- and incompatibly-different versions get their own packages. For instance, Python 2.6, Python 2.7, Python 3.1 all live in separate packages on Ubuntu.
Of particular importance is the fact that one of Ubuntu policies is to extensively use Python for writing end-user software. So in fact, fairly large part of the system is written in Python. At the moment, the code runs on Python 2.6 — so this version is the default upon installation; and the code won't easily run on, say, Python 2.7 — because incompatibilities exist. To switch the system to Python 2.7 there needs to be done a piece of work, consisting of updating and re-testing all the scripts. This can't be done easily; that is, you can't just "switch" your system to Python 2.7 and delete the older version.
But. If you don't care about fancy gears of your system and just need newer Python — see no obstacles. Go and sudo apt-get install python3
and code for 3.x Python bravely; just remember to launch your scripts with python3
and use #!/usr/bin/env python3
shebang line.
If your system is up to date so is the Python on your system (according to your repositories). Am I wrong? – cYrus – 2011-02-05T00:19:25.673