Hi
My requirement is to check a variable with a set of constant values
and call a particular function depending on the value of the variable. A
C-language implementation might look something like :
switch (a) {
case 1 : func1();
case 2 : func2() ;
default : func3();
}
How to do it in Python ?
Ofcourse an if-elif construct can also be used to do the job, which is
indeed my last option. However i would like to know if a 'switch-case'
option is available.
I found some implementations involving dictionaries and lambdas but i
don't know how suitable they might be for this kind of an
implementation.
Any suggestions and ideas welcome
Thanks and regards
Parasuram N.A.
I know the answers to all the questions
But its just that i don't find some of them worth answering
The information contained in this electronic message and any attachments to
this message are intended for the exclusive use of the addressee(s) and may
contain proprietary, confidential or privileged information. If you are not the
intended recipient, you should not disseminate, distribute or copy this e-mail.
Please notify the sender immediately and destroy all copies of this message and
any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should
check this email and any attachments for the presence of viruses. The company
accepts no liability for any damage caused by any virus transmitted by this
email.
www.wipro.com
--
http://mail.python.org/mailman/listinfo/python-list