Python newbie needs constructive suggestions
Chris Lambacher
chris at kateandchris.net
Mon Jul 24 10:48:11 EDT 2006
On Sat, Jul 22, 2006 at 09:31:26PM +0200, Bruno Desthuilliers wrote:
> Lawrence D'Oliveiro a ?crit :
> > In message <mailman.8409.1153526071.27775.python-list at python.org>,
> > davew-python at cs.haverford.edu wrote:
> >
> >
> >> b) give up on using an anonymous function and create a named "successor"
> >> function with "def",
> >
> >
> > This is what you have to do.
>
> Not necessarily.
>
> map(lambda x, one=1: one + x, range(42))
Note that in Python this particular expression is normally written as:
a = [x + 1 for x in range(42)]
List comprehension and Generator expressions are generally seen as the
solution to not having to deal with map, and reduce.
>
> > For some reason mr van Rossum has this aversion
> > to anonymous functions, and tries to cripple them as much as possible.
>
> For some reasons, including the fact that Python is statement based and
> have significative indentation, it's actually not trivial to come with a
> better syntax for lambdas. The horse has been beaten to hell and back,
> and no one managed to propose anything worth implementing so far. But if
> you have the solution to this problem, please share...
> --
> http://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list