lambda question
David Bear
david.bear at asu.edu
Tue Mar 11 16:38:12 EST 2003
I was hoping to use lambda to create some quick string transforming
functions. So I did :
name = "a title"
title = lambda s: "<title> % </title>" % s
print title(name)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "<stdin>", line 1, in <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?
More information about the Python-list
mailing list