> switch = { 

>     'A': functools.partial(spam, a),
>     'B': lambda b, c=c: ham(b, c),
>     'C': eggs,
>     }
> 
> switch[letter](b)

That's cool, never even thought to use lambdas.

> functools.partial isn't always applicable, but when it is, you should
> prefer it over lambda since it will be very slightly more efficient.


Ok, haven't used this before but I will give it a read!


Much appreciated Steven!
jlc
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to