FIXED: Dynamically reference variables in object

2014-03-26 Thread Ben Collier
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 have an object called "device", with variables called attr1, attr2 .. attr50, how could I dynamically reference these? It's fai

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 varia

Dynamically reference member of array

2014-03-26 Thread Ben Collier
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 have an object called "device", with variables called attr1, attr2 .. attr50, how could I dynamically reference these? It's fairly