Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #79799
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2014-10-27 11:23 -0700 |
| Message-ID | <6fc1feb3-651e-49e9-8a5d-66dc0599a754@googlegroups.com> (permalink) |
| Subject | variable attribute name |
| From | Harvey Greenberg <hjgreenberg@gmail.com> |
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.<s> = 1 The last line denotes the variable value by <s> (not a python form). What I want is to have A.attr = 1, but 'attr' determined by the value of s. Please advise.
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
variable attribute name Harvey Greenberg <hjgreenberg@gmail.com> - 2014-10-27 11:23 -0700 Re: variable attribute name Larry Martell <larry.martell@gmail.com> - 2014-10-27 14:32 -0400 Re: variable attribute name Ned Batchelder <ned@nedbatchelder.com> - 2014-10-27 15:48 -0400
csiph-web