Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Malcolm Greene Newsgroups: comp.lang.python Subject: Dynamically call methods where method is known by address vs name Date: Fri, 22 Jul 2016 16:04:28 -0400 Lines: 18 Message-ID: References: <1469217868.1572637.674159593.622C5164@webmail.messagingengine.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: news.uni-berlin.de viG6+ugvH5eBZjzpUA6yewodj1CKoHRszq/ChgVEl5Xg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'received:internal': 0.09; 'subject:method': 0.09; '>>>': 0.15; "'address'": 0.16; 'from:addr:python': 0.16; 'malcolm': 0.16; 'message- id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:io': 0.16; 'received:messagingengine.com': 0.16; 'received:psf.io': 0.16; 'subject:where': 0.16; 'string': 0.17; '>>>': 0.20; 'name?': 0.29; 'could': 0.35; 'but': 0.36; 'to:addr:python-list': 0.36; 'received:10': 0.37; 'method': 0.37; 'received:66': 0.38; 'thank': 0.38; 'to:addr:python.org': 0.40; 'header:Message-Id:1': 0.61; '(better': 0.84; 'subject:address': 0.84 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=bdurham.com; h= content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=Ttn uGtnAAJDzjQ1/jh4ic7l4F84=; b=h/QMGK3UNx9/YeoF7iGb/Fv1L+VDjv877ux Pg6wTajmkmrYN1WsV98DNaZdKKHRA/fXrMB3776CdtMTibSA82sSY46tvJLsNf6d WK/KbzA3GicS8V+XZA4SZgWNu5NuxVylrzsucRVgWfSEftagzJQOaAXwZDCZRpRk kDO69EVE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=TtnuGtnAAJDzjQ1/jh4ic7l4F84=; b=aVnyg arIZut/iQymIAY7pjOY2czrpcs0lOgkwubBiy3PrkaWTRVqOxLTUahXqZPPCSWgC 4cY/5QZkkRtRF6ciATE/xoLj1qfmct6Myy5ZLXGlXX8Lvc0X9nW1f4T0xj9hwlC0 0ddg8CP1o1DfuRkb7xdZoKzDEJ9ebyomh0lY18= X-Sasl-Enc: O8o6szKQihYccQ/oxIPhzdcdgElZ9RidWatK/Tli5AmE 1469217868 X-Mailer: MessagingEngine.com Webmail Interface - ajax-2ccfea0a X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <1469217868.1572637.674159593.622C5164@webmail.messagingengine.com> Xref: csiph.com comp.lang.python:111772 I know I can do the following: =20 >>> s =3D 'lower' >>> getattr(s, 'upper')() 'LOWER' =20 But how could I do the same if I had the method 'address' (better name???) vs. method name? =20 >>> upper_method =3D s.upper =20 How do I combine this upper_method with string s to execute the method and return 'LOWER'? =20 Thank you, Malcolm =20 =A0