Re: variable attribute name

2014-10-27 Thread Ned Batchelder
On 10/27/14 2:32 PM, Larry Martell wrote: On Mon, Oct 27, 2014 at 2:23 PM, Harvey Greenberg wrote: I want to let the name of an attribute be the string value of a variable. Here is some code: class Object(object): pass A = Object() s = 'attr' A. = 1 The last line denotes the variable value

Re: variable attribute name

2014-10-27 Thread Larry Martell
On Mon, Oct 27, 2014 at 2:23 PM, Harvey Greenberg wrote: > I want to let the name of an attribute be the string value of a variable. > Here is some code: > > class Object(object): pass > A = Object() > s = 'attr' > A. = 1 > > The last line denotes the variable value by (not a python form). Wha

variable attribute name

2014-10-27 Thread Harvey Greenberg
I want to let the name of an attribute be the string value of a variable. Here is some code: class Object(object): pass A = Object() s = 'attr' A. = 1 The last line denotes the variable value by (not a python form). What I want is to have A.attr = 1, but 'attr' determined by the value of s.