Re: Dynamically reference variable in object

2014-03-26 Thread Steven D'Aprano
On Wed, 26 Mar 2014 15:19:03 -0600, Ian Kelly wrote: > You want to access object "attributes", not "variables". In fairness to the OP, the terminology "instance variables" meaning attributes or members of an instance is (sadly, in my opinion) common in some other languages, such as Java, and oc

Re: Dynamically reference variable in object

2014-03-26 Thread Ian Kelly
On Mar 26, 2014 5:48 AM, "Ben Collier" wrote: > > Sorry, subject was wrong. Please see below: > > On Wednesday, 26 March 2014 11:43:49 UTC, Ben Collier wrote: > > Hi all, > > I know that I can dynamically reference a variable with locals()["i"], for instance, but I'd like to know how to do this w

Dynamically reference variable in object

2014-03-26 Thread Ben Collier
Sorry, subject was wrong. Please see below: On Wednesday, 26 March 2014 11:43:49 UTC, Ben Collier wrote: > Hi all, > > > > I know that I can dynamically reference a variable with locals()["i"], for > instance, but I'd like to know how to do this with a variable in an object. > > > > If I h