Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!gegeweb.org!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.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.041 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'spelling': 0.09; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:which': 0.16; 'tweak': 0.16; 'wrote:': 0.17; 'version.': 0.17; 'thanks.': 0.21; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'methods.': 0.29; 'skip:_ 10': 0.29; 'shorter': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'subject:?': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'rather': 0.37; 'received:209': 0.37; 'to:addr:python.org': 0.39; '2013': 0.84; 'subject:better': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=ZeBoTSAv54JSF4zVhIuIoYZ+Ftna5nd+2d9rpTsJry0=; b=xRMxPO7p8UpZ2RUJmozP3VyqyZuGaOB5+irgL2Z1mQ2tAbHULjb/oQWrw9Te/ijUdQ HJbAMsj0cgczNGh+ICKfOusAuUf8zZYbGVHosSKG06hHEqB/zwVRFMs1HU67v4qiedYU h/wjGWAVVnXtFal26AUa0yKjnami/oReeJv7e/2lIOnZVzxusuRaxwFR4fKm6hNUFKMX KAz2AGB29cEfwu4DqZq8Rj/69b++f26WjUGfNouWqObkqwZ47nvJbqoTHJBuqwwEipjT 93fkz/NibNoyjNeAQ9xxS14rOW4WZicplz7Zf7yfLMyO8gliXpNo/GthMKgqGSk1dmk9 SFMA== MIME-Version: 1.0 X-Received: by 10.58.50.7 with SMTP id y7mr20269604ven.24.1363615491000; Mon, 18 Mar 2013 07:04:51 -0700 (PDT) In-Reply-To: <1282143233.6013541.1363615124749.JavaMail.root@sequans.com> References: <1282143233.6013541.1363615124749.JavaMail.root@sequans.com> Date: Tue, 19 Mar 2013 01:04:50 +1100 Subject: Re: "eval vs operator.methodcaller" - which is better? From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 9 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1363615498 news.xs4all.nl 6848 [2001:888:2000:d::a6]:47060 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:41419 On Tue, Mar 19, 2013 at 12:58 AM, Jean-Michel Pichavant wrote: > myFunc = getattr(myModule, methodName) Doh! Thanks. I knew there was a shorter way of spelling it, rather than digging with dunder methods. That's the way I would recommend - slight tweak from the __getattribute__ version. ChrisA