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


Groups > comp.lang.python > #41419

Re: "eval vs operator.methodcaller" - which is better?

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 <rosuav@gmail.com>
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 <CAFtnWG-8dndo6KYrmKvgsbiB5YkfBOgbPLrzHXauuOygvGbHtw@mail.gmail.com> <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 <rosuav@gmail.com>
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3449.1363615498.2939.python-list@python.org> (permalink)
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

Show key headers only | View raw


On Tue, Mar 19, 2013 at 12:58 AM, Jean-Michel Pichavant
<jeanmichel@sequans.com> 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

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


Thread

Re: "eval vs operator.methodcaller" - which is better? Chris Angelico <rosuav@gmail.com> - 2013-03-19 01:04 +1100

csiph-web