sudo pip install pythonpy && alias py='pythonpy'
For a permanent alias (For Bash users):
echo "alias py='pythonpy'" >> ~/.bashrc
$ py '3 * 1.5' 4.5
$ py '7**3' 343
$ py 'range(3)' 0 1 2
$ py '[x**2 for x in range(1,5)]' 1 4 9 16
$ py 'math.exp(1)' 2.71828182846
$ py 'random.random()' 0.103173957713
$ py 'range(3)' | py -x 'int(x)*7' 0 7 14
$ py 'range(3)' | py -x 'x + ".txt"' 0.txt 1.txt 2.txt
$ py 'range(4)' | py -l 'sorted(l, reverse=True)' 3 2 1 0
$ py 'range(4)' | py -l 'sum(int(x) for x in l)' 6
$ py 'range(17)' | py -l 'len(l)' 17
$ py 'range(8)' | py -x 'x if int(x)%2 == 0 else None' 0 2 4 6
$ py 'range(8)' | py -fx 'int(x)%2 == 1' 1 3 5 7
$ cat /usr/share/dict/words | py -fx 're.match(r"and", x)' | head -5 and andante andante's andantes andiron
$ cat /usr/share/dict/words | py -fx 're.match(r"ba.*ing$", x)' | head -5 baaing babbling babying babysitting backbiting
$ cat /usr/share/dict/words | py -fx 'x==x[::-1] and len(x) >= 5' | head -5 civic deified kayak level ma'am
$ ifconfig | py -x --i 're.search(r"192\.168[\d\.]+", x).group()' 192.168.1.41