2011/10/21 Miles Bader <

[hidden email]>:

> "Patrick Mc(avery" <

[hidden email]> writes:

>> Python is so much easier to learn then Lua

>

> It isn't.

>

> Or rather, there's nothing about the _language_ that makes Python

> "easier" -- but it has better library support, better infrastructure

> support, many more eyes on it, more communities, more examples, and

> many more people who know it and are willing to help their friends.

> _That's_ why it's "easy" to learn Python.

>

> If you want to make Lua similarly "easy", the language itself has

> little to do with it.

>

>

I'll confess, I used to be a Pythonista. I'm still a seasonal one:

once a year I teach a course on Sage, which is built on top of Python.

That season is now, so yesterday I wrote a Python program, as

follows:

~~~~

def perms(a):

if len(a)==1: return [a]

return [[a[k]]+p for k in range(len(a)) for p in perms(a[:k]+a[k+1:]) ]

def cubes():

main = [tuple([1,2]+p) for p in perms([3,4,5,6])]+[

tuple([1,3]+p+[2]) for p in perms([4,5,6])]

return [(m,(U,L,B,F,R,D),(U,B,R,L,F,D),(U,R,F,B,L,D))

for m in main for U,F,L,R,B,D in [m]]

cube=cubes()

print '\n'.join(["%2i: "%(k+1) + ' '.join(["%i%i%i-%i%i%i"%c

for c in cube[k]]) for k in range(len(cube))])

~~~~

You don't immediately see what it does? After all the trouble I've

taken to use descriptive names like "perms" and "cubes"? You surprise

me.

That's Python. Concise. Hyper-elegannt. Incomprehensible. (Except

if you are a list, o0f course.)

Now imagine the same program in Lua. Twice the length, written in

half the time.

Dirk