Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.023 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'args': 0.04; 'case.': 0.05; 'none,': 0.05; 'appropriate.': 0.09; 'guys!': 0.09; 'lambda': 0.16; 'received:172.18.0': 0.16; 'to:name:python- list@python.org': 0.20; '>': 0.23; 'pass': 0.25; 'header:In- Reply-To:1': 0.25; 'arguments.': 0.29; 'worked': 0.30; 'function': 0.30; 'suggestion': 0.32; 'could': 0.32; 'like:': 0.33; 'to:addr :python-list': 0.33; 'skip:d 20': 0.34; 'thanks': 0.34; 'especially': 0.35; 'something': 0.35; 'there': 0.35; 'charset:us- ascii': 0.36; 'well.': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'called': 0.39; 'easy': 0.60; 'most': 0.61; 'different': 0.63; 'received:unknown': 0.63; 'within': 0.64; 'fact,': 0.69 X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.1 cv=YO+FcVZrxpdWV6Mo6AkY2Rtp7tuV51ZJEd1ZQZEmJbs= c=1 sm=1 a=CRTDazI5n6YA:10 a=7PYXob_7ZXMA:10 a=BLceEmwcHowA:10 a=xqWC_Br6kY4A:10 a=oNw28mxuUhXRB3mVwYQ4Ag==:17 a=NGOQQrtOlQj73J9GMWYA:9 a=CjuIK1q_8ugA:10 a=yYls_xZeWIgWWiZljTUA:9 a=_W_S_7VecoQA:10 a=frz4AuCg-hUA:10 a=Zg4X-VmYMOT6zIIy:21 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 From: "Joseph L. Casale" To: "python-list@python.org" Subject: RE: Switch statement Thread-Topic: Switch statement Thread-Index: AQHOHdAzoGPFc7fw1UePzo9IXt3xQJif23iA//+ii+g= Date: Sun, 10 Mar 2013 22:18:37 +0000 References: <513CF030.9030808@lightbird.net>, In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.18.0.200] Content-Type: multipart/alternative; boundary="_000_1ebcb3be6cad4704aa7304bb10c9bfd3exchactivenetwerxcom_" MIME-Version: 1.0 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 85 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1362953935 news.xs4all.nl 6891 [2001:888:2000:d::a6]:58909 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:41042 --_000_1ebcb3be6cad4704aa7304bb10c9bfd3exchactivenetwerxcom_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > Or could you do something like: > > arguments_to_pass =3D [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 --_000_1ebcb3be6cad4704aa7304bb10c9bfd3exchactivenetwerxcom_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
> Or could you do something like:
> arguments_to_pass =3D [list of some sort]
> switch.get(var, def= ault)(*arguments_to_pass)

Stevens lambda suggestion was most ap= propriate. Within the switch, there
are functions called with none, or so= me 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 whic= h case.

The lamda worked well.

Thanks guys!
jlc
--_000_1ebcb3be6cad4704aa7304bb10c9bfd3exchactivenetwerxcom_--