On Sun, Feb 8, 2015 at 11:45 AM, Albert van der Horst <alb...@spenarnc.xs4all.nl> wrote: > def square(x): x**2 > but > square = x->x**2 > > or > > mult = x,y -> > result = 0 > for i in range(x): > result +=y > return result > > doing away with the ternary operator def > > def .. ( .. ) : .. > > replacing it by two binary operators, one of them (=) being thoroughly > familiar.
Thing is, "def" isn't just assignment. It also takes the name and stores it in the object. There's a distinct and visible difference between: def square(x): return x**2 and def func(x): return x**2 square = func So if you were to use your alternate syntax everywhere, you'd basically be throwing away all the benefits of def over lambda. Now, you may well be able to justify and implement an alternative for lambda that works this way. (And it's probably already been done, too. Maybe using the actual symbol λ rather than ->.) But I don't think you'll get anywhere with def. ChrisA -- https://mail.python.org/mailman/listinfo/python-list