2013-01-18

Please upgrade to Python 2.7!

I am a Pythonista (or a Pythonist, or a Pythoneer). I write more lines of Python code than sentences I say to girls everyday.

That is why I cannot stand that so many systems do not have Python 2.7, but only Python 2.6.

A ``Big Data'' life without Python 3.x or at least Python 2.7 is painful - more miserable than not having a girlfriend.

I just wanna show one feature that was backported to Python 2.7 from Python 3.0: dictionary or set comprehension.

Look at this piece of code:

forrest@hogwarts:~$ python
Python 2.7.2+ (default, Jul 20 2012, 22:15:08) 
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> a={x:x+2 for x in range(5,9)}
>>> a
{8: 10, 5: 7, 6: 8, 7: 9}

This feature does not exist in Python 2.6 or earlier.

If you don't have dictionary comprehension, you need a loop to add pairs of keys and values into a dictionary - and that cannot be done in just one line (to the best of my knowledge).

Sets and dictionaries are frequently used data structures in scientific computing.

Dear system administrators of clusters and servers I use, please please please, install Python 2.7 or just simply upgrade your CentOS 6.

No comments: