lambda question

Steven Taschuk staschuk at
Wed Mar 12 00:03:45 CET 2003

Quoth David Bear:
> title = lambda s: "<title> % </title>" % s

You want "%s" instead of "%".  Nothing to do with lambda.

> I don't understand this.  Is lambda not a good way to do this?  I was hoping 
> to avoid function overhead by creating some anonymous functions, but I 
> guess I don't understand how to use them.. any comments?

I'd be surprised to learn that lambda functions and def functions
have different overhead.  Why are you expecting an improvement?

Steven Taschuk             "The world will end if you get this wrong."
staschuk at    (Brian Kernighan and Lorrinda Cherry,
                            "Typesetting Mathematics -- User's Guide")

More information about the Python-list mailing list