Beginners' Question -- Assigning variables in a lambda

Paul Prescod paul at prescod.net
Fri May 26 14:57:54 EDT 2000


> After I've done my getopt (or maybe instead, if I can get this to work) I
> want to avoid the if/elif/else from hell by having a dictionary of
> parameter names and functions, something like:

Lambda is just a short form syntax for function definition and
assignment. You can set up a dictionary of plain old functions:

def setBandwidth: 
	bandwidth = get_number(" + x + ")"

handler={"b":setBandwidth}

-- 
 Paul Prescod  - ISOGEN Consulting Engineer speaking for himself
Just how compassionate can a Republican get before he has to leave the 
GOP and join Vegans for Global Justice? ... One moment, George W. Bush
is holding a get-to-know-you meeting with a bunch of gay Republicans.
The next he is holding forth on education or the environment ... It is
enough to make a red-blooded conservative choke on his spotted-owl
drumstick.     - April 29th, Economist




More information about the Python-list mailing list