parameter undefined in procedure
David Smith
drs at labs.agilent.com
Fri Feb 25 16:56:42 EST 2000
Moshe Zadka wrote:
> The "lambda" expression defines a function. Inside it, the only locals
> are the parameters (since there can be no assignments inside a lambda),
> so in your case the only local is "x". "dictionary" isn't a global,
> and it isn't a builtin (thank God!) either. If you want your lambda
> expression to see it, you have to explicitly define it:
>
> return map(lambda x, dictionary=dictionary: dictionary.get(x, "default"),
> list)
Thank you for the clarification.
> If you think this is god-awful ugly, you're right. Why not code it
> as an explicit loop?
Lisp hangover, I suppose. Which is also the reason lambda is in Python,
no?
David Smith
More information about the Python-list
mailing list