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


Groups > comp.lang.python > #56919

Re: how to add object from dict

References <1381961694.21908.13.camel@debian> <525F3297.2040406@mrabarnett.plus.com>
Date 2013-10-17 11:46 +1100
Subject Re: how to add object from dict
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.1134.1381970815.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Thu, Oct 17, 2013 at 11:43 AM, MRAB <python@mrabarnett.plus.com> wrote:
> I'm guessing, but perhaps you need:
>
>     instance = getattr(self, "%s" % key)

How's that different from getattr(self,str(key))?

ChrisA

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


Thread

Re: how to add object from dict Chris Angelico <rosuav@gmail.com> - 2013-10-17 11:46 +1100
  Re: how to add object from dict Steven D'Aprano <steve@pearwood.info> - 2013-10-17 09:02 +0000

csiph-web