On 06/04/2006, at 13:15, Robin Haswell wrote:
> [OT]:
>
> Damn I wish Python has a switch/case structure.
>
> switch action:
>       case "Edit":
>               # something
>       case "Delete":
>               # something else
>       case "Something Else":
>               # etc
>
> ..is a lot nicer than..
>
> if action is "Edit":
>       # something
> if action is "Delete":
>       # something else
> if action is "Something Else":
>       # etc
>
> DRY!

What? That's what mappings and generic functions are for. It's even  
nicer:

result = action_mapper[action]

You can even change/build them on the fly!

Take a look at http://dirtsimple.org/2004/12/python-is-not-java.html

Alberto


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to