Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #60198
| From | Gregory Ewing <greg.ewing@canterbury.ac.nz> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: using getattr/setattr for local variables in a member function |
| Date | 2013-11-22 17:07 +1300 |
| Message-ID | <bf83knFu0s8U1@mid.individual.net> (permalink) |
| References | <l6m40a$9vd$1@news.jpl.nasa.gov> |
Catherine M Moroney wrote: > is there > some way to use getattr/setattr to access the local variables specific > to a given function? No, because those variables don't even exist when there isn't a call to the function in progress. Your example suggests that, instead of local variables, you really want them to be attributes of your object somehow. The best way to go about that will depend on how you want to use them. If you explain more about the problem you're trying to solve, we may be able to suggest a solution. -- Greg
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
using getattr/setattr for local variables in a member function Catherine M Moroney <Catherine.M.Moroney@jpl.nasa.gov> - 2013-11-21 15:12 -0800 Re: using getattr/setattr for local variables in a member function MRAB <python@mrabarnett.plus.com> - 2013-11-22 00:52 +0000 Re: using getattr/setattr for local variables in a member function Ned Batchelder <ned@nedbatchelder.com> - 2013-11-21 17:58 -0800 Re: using getattr/setattr for local variables in a member function Dave Angel <davea@davea.name> - 2013-11-21 21:02 -0500 Re: using getattr/setattr for local variables in a member function Ethan Furman <ethan@stoneleaf.us> - 2013-11-21 19:18 -0800 Re: using getattr/setattr for local variables in a member function Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2013-11-22 17:07 +1300
csiph-web