Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.mixmin.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4.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.059 X-Spam-Evidence: '*H*': 0.91; '*S*': 0.02; 'mrab': 0.05; '"%s"': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'key)': 0.16; 'need:': 0.16; 'subject:object': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'subject:from': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'to:addr:python- list': 0.38; 'to:addr:python.org': 0.39; 'different': 0.65; "how's": 0.74; 'subject:add': 0.91; '2013': 0.98 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 :content-type; bh=L976FUhAT1aQA9HzrrY9yCqci/OYG5GAyvVQ9nJ4bEg=; b=Vseik5Yt6sy1AecPbHDKPvougs1ZT2NHI0uWCXlKhPKTHkwSzIgy/PLLG22PnS4NgW oKPEgdqrnA+VB2C9obPaDep+joSpsl63xfK7rOC7eFP7lkMmJfnzv7ke7WmSmLPrFLHy RrP3FPBqlOQy+6adREgoS1WEyrqeB6lSvjMXJHkyzPoVLIzpeM7zQvbnN6bFUbOu+3c9 HCmEMWhDCGP1T9dtpyDU/apGNfZT1sK2YD0DJiExhdxGuIgNmH6PQOX4Gt/f959ZqbUv CDu7q3wZPcIpDFGLHM9hS0eS8JJsXp25aWa4cZVfnnJv3Gdw7D62IAOwnyErNp3Dfaqr WlnQ== MIME-Version: 1.0 X-Received: by 10.66.171.13 with SMTP id aq13mr6329288pac.30.1381970812596; Wed, 16 Oct 2013 17:46:52 -0700 (PDT) In-Reply-To: <525F3297.2040406@mrabarnett.plus.com> References: <1381961694.21908.13.camel@debian> <525F3297.2040406@mrabarnett.plus.com> Date: Thu, 17 Oct 2013 11:46:52 +1100 Subject: Re: how to add object from dict 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: 8 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1381970815 news.xs4all.nl 15986 [2001:888:2000:d::a6]:51545 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:56919 On Thu, Oct 17, 2013 at 11:43 AM, MRAB wrote: > I'm guessing, but perhaps you need: > > instance = getattr(self, "%s" % key) How's that different from getattr(self,str(key))? ChrisA