In message <[EMAIL PROTECTED]>, Steven D'Aprano wrote: > On Fri, 17 Oct 2008 23:04:52 +1300, Lawrence D'Oliveiro wrote: > >> The right solution, of course, is >> >> fns = [(lambda x : lambda : x)(x) for x in range(10)] > > Only if by "right solution" you mean "excessively verbose, confusing, and > the sort of thing that makes even supporters of lambda cringe". > > Yes yes, it's just a factory function written with lambdas. It's still > ugly and exactly the sort of thing that gives ammunition to lambda- > haters.
It's NOT ugly. It's EXACTLY the right sort of thing you do with lambda-expressions, going right back to Church. It's no more ugly than, say, parentheses in Lisp. :) -- http://mail.python.org/mailman/listinfo/python-list