>
> cases = {
> 1: lambda: x*2
> 2: lambda: y**2
> 3: lambda: sys.stdout.write("hi\n")
> }
>

i forgot the commas.

 cases = {
 1: lambda: x*2,
 2: lambda: y**2,
 3: lambda: sys.stdout.write("hi\n")
 }


>
> your functions and lambdas can also take parameters of course
>

lambda a, b: a*b
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to