Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'handler': 0.05; 'subject:Python': 0.06; 'subject:command': 0.09; 'subject:parsing': 0.09; 'subject:using': 0.09; 'cc:addr:python- list': 0.11; 'inputs': 0.16; 'merged': 0.16; 'subject:options': 0.16; 'to:addr:web.de': 0.16; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'subject: : ': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'message- id:@mail.gmail.com': 0.30; 'lines': 0.31; 'worked': 0.33; 'subject:the': 0.34; 'could': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'version': 0.36; 'thanks': 0.36; 'two': 0.37; 'first': 0.61; 'valuable': 0.63 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=A6mubZFvmpPtNvMiehpynJ/JTRYYWxcim3OP7Sc+Whs=; b=Jhf1vswc9TS1RCr4lGjEvkpkqgpytN+9hBqy+/7IxtFUuocTFQs38MzIGJLoOj1xAi BNL5D3B2iHjVjPOe6yR/voBZfOE5eHehloeNK2zHvlghLGRkQpg5NCuQATAQknKNsZHa BheOcIfS5mXu/pVHas1zWfI0Tv3H4VJPG6RIVAPbz16hkmPbsm4CdXsvhX5PEp1+F8Ul jPP6dI2b/NXMDSZds+yv2bENtOrjBJecsDZbI+Uphplz/iiEiZTNGYw+AurTmj2QCb9C kY/owRX+uDCGs5ExbFDc89hPKnVGOpfc2LEWGJNoWCQ1Jd8BZsaEvuQikxjR6V0oGFHr 4uIA== MIME-Version: 1.0 X-Received: by 10.112.22.196 with SMTP id g4mr10434254lbf.47.1393675924054; Sat, 01 Mar 2014 04:12:04 -0800 (PST) In-Reply-To: References: Date: Sat, 1 Mar 2014 17:42:03 +0530 Subject: Re: Python : parsing the command line options using optparse From: Ganesh Pal To: Peter Otten <__peter__@web.de> Content-Type: multipart/alternative; boundary=14dae9473ba362a79c04f38a769a Cc: python-list@python.org 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: 40 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1393675926 news.xs4all.nl 2920 [2001:888:2000:d::a6]:54988 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:67312 --14dae9473ba362a79c04f38a769a Content-Type: text/plain; charset=ISO-8859-1 > > handler = object_type_dictionary[options.object_type] # look up the > function > handler() # call it > > The last two lines could also be merged into one > > object_type_dictionary[options.object_type]() > > but the first version may be clearer. > > Thanks for your valuable inputs all worked :) --14dae9473ba362a79c04f38a769a Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

=

handler =3D object_type_dictionary[options.object_type] # look up the funct= ion
handler() # call it

The last two lines could also be merged into one

object_type_dictionary[options.object_type]()

but the first version may be clearer.



<= /div>
Thanks =A0for your valuable inputs all work= ed :)
--14dae9473ba362a79c04f38a769a--