Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #5551
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!nx01.iad01.newshosting.com!newshosting.com!69.16.185.16.MISMATCH!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!news.glorb.com!news.astraweb.com!border5.newsrouter.astraweb.com!not-for-mail |
|---|---|
| From | Ben Finney <ben+python@benfinney.id.au> |
| Newsgroups | comp.lang.python |
| Subject | Re: indirect assignment question |
| References | <mailman.1657.1305609210.9059.python-list@python.org> |
| X-Public-Key-ID | 0xAC128405 |
| X-Public-Key-Fingerprint | 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 |
| X-Public-Key-URL | http://www.benfinney.id.au/contact/bfinney-pubkey.asc |
| X-Post-From | Ben Finney <bignose+hates-spam@benfinney.id.au> |
| Date | Tue, 17 May 2011 16:01:25 +1000 |
| Message-ID | <87y625euh6.fsf@benfinney.id.au> (permalink) |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) |
| Cancel-Lock | sha1:7Tgsudwt8B+uQaZSz6c9GRaZ/KQ= |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 8bit |
| Lines | 25 |
| Organization | Unlimited download news at news.astraweb.com |
| NNTP-Posting-Host | b2edf23d.news.astraweb.com |
| X-Trace | DXC=<_4kNRFf\AXJRMXARX<CETL?0kYOcDh@ZN7:H2`MmAUSel::[kgGj3R]G;2>V^?kWSbEW9A[5UK?UNZ[SL`C\KgS;kPbO=KRI;_ |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:5551 |
Show key headers only | View raw
Andy Baxter <highfellow@gmail.com> writes:
> with something like this:
> widgetDic = {
> "mainWindow": self.window,
> "menuitem_output_on": self.outputToggleMenu,
> "button_toggle_output": self.outputToggleButton,
> "textview_log": self.logView,
> "scrolledwindow_log": self.logScrollWindow
> }
> for key in widgetDic:
> ... set the variable in dic[key] to point to
> self.wTree.get_widget(key) somehow
>
> what I need is some kind of indirect assignment where I can assign to
> a variable whose name is referenced in a dictionary value.
for (name, value) in widgetDic.iteritems():
setattr(self, name, value)
--
\ “The double standard that exempts religious activities from |
`\ almost all standards of accountability should be dismantled |
_o__) once and for all.” —Daniel Dennett, 2010-01-12 |
Ben Finney
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
indirect assignment question Andy Baxter <highfellow@gmail.com> - 2011-05-17 06:13 +0100 Re: indirect assignment question Ben Finney <ben+python@benfinney.id.au> - 2011-05-17 16:01 +1000 Re: indirect assignment question Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-05-17 09:15 +0200
csiph-web