Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #41042

RE: Switch statement

From "Joseph L. Casale" <jcasale@activenetwerx.com>
Subject RE: Switch statement
Date 2013-03-10 22:18 +0000
References <f529f94d99404cefa9b832ebf57d2898@exch.activenetwerx.com> <CAAu18hdW99y9MxEatrps3fMopqZk7A=J_78+zXj_4o1-ncJ1nQ@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.3171.1362953935.2939.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

> Or could you do something like:
>
> arguments_to_pass = [list of some sort]
> switch.get(var, default)(*arguments_to_pass)

Stevens lambda suggestion was most appropriate. Within the switch, there
are functions called with none, or some variation of arguments. It was not
easy to pass them in after the fact, especially since the same function may
have different args depending on which case.

The lamda worked well.

Thanks guys!
jlc

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

RE: Switch statement "Joseph L. Casale" <jcasale@activenetwerx.com> - 2013-03-10 22:18 +0000

csiph-web