Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #5549
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <highfellow@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.007 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'assign': 0.05; 'dictionary': 0.07; 'python?': 0.07; 'referenced': 0.09; 'this:': 0.11; 'received:74.125.82.174': 0.12; 'received:mail- wy0-f174.google.com': 0.12; 'baxter': 0.16; 'indirect': 0.16; 'thanks,': 0.17; 'variable': 0.21; 'code': 0.22; 'subject:question': 0.22; 'somehow': 0.23; 'value.': 0.25; 'hi,': 0.29; 'message-id:@gmail.com': 0.30; 'andy': 0.31; 'to:addr :python-list': 0.32; '...': 0.32; '(for': 0.33; 'lines': 0.34; 'received:192': 0.34; 'skip:" 10': 0.34; 'received:192.168.0': 0.35; 'there': 0.35; 'header:User-Agent:1': 0.35; 'point': 0.35; 'assignment': 0.35; 'doing': 0.36; 'received:192.168': 0.37; 'some': 0.37; 'received:google.com': 0.38; 'skip:" 20': 0.38; 'url:org': 0.38; 'set': 0.39; 'skip:s 30': 0.39; 'to:addr:python.org': 0.39; 'where': 0.39; 'would': 0.40; 'header:Received:5': 0.40; 'received:192.168.0.5': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :subject:content-type:content-transfer-encoding; bh=f4lD1J1BUCYUgyudxQJN42CQreDtNMSLcADxnEHzOV8=; b=ZsbKjoNEbqc+J9A3NjCHuuKIg7LCbdTYTao2gGDLWb3faTymgZZM5RLexqlhZYb/5u WNhZqFtupInD1yxPag7IyxQtwopWWiCHSEecF4xS/+vI8eklJYmiAHqMTRepwbgyjJ2I y1yXrLky9CUy95cZOEie88JJqmJ7R6BqB/d4E= |
| DomainKey-Signature | a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=MI9Q6vCmV1jG1+Y0h5lxcCDXww9pYXMROgkS2FNlR8Eleoe16byY3xqLVDtfGiDSdL 4E5yXhV8e9TRmHgUJ2MxeQq4HQmNyDizxEcbfJ+j68Mo/xkrBzTreY6gAkpxp+y3qMCH mX41oK+0Jl4bUg71vzPL2BHEl8wh4Xbn4Klb0= |
| Date | Tue, 17 May 2011 06:13:21 +0100 |
| From | Andy Baxter <highfellow@gmail.com> |
| User-Agent | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | indirect assignment question |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1657.1305609210.9059.python-list@python.org> (permalink) |
| Lines | 37 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1305609210 news.xs4all.nl 49175 [::ffff:82.94.164.166]:52383 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:5549 |
Show key headers only | View raw
Hi,
I have some lines of code which currently look like this:
self.window = self.wTree.get_widget("mainWindow")
self.outputToggleMenu = self.wTree.get_widget("menuitem_output_on")
self.outputToggleButton =
self.wTree.get_widget("button_toggle_output")
self.logView = self.wTree.get_widget("textview_log")
self.logScrollWindow = self.wTree.get_widget("scrolledwindow_log")
and I would like (for tidiness / compactness's sake) to replace them
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.
Is there a way of doing this in python?
thanks,
andy baxter
--
http://highfellow.org
Back to comp.lang.python | Previous | Next — 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