Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #16931
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ethan@stoneleaf.us> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'exec': 0.07; 'python': 0.08; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'keys,': 0.09; 'message- id:@stoneleaf.us': 0.09; 'received:gator410.hostgator.com': 0.09; 'subject:string': 0.09; '~ethan~': 0.09; '"%s': 0.16; '"dirty': 0.16; 'bound.': 0.16; 'chris,': 0.16; 'received:72.11': 0.16; 'received:72.11.125': 0.16; 'received:72.11.125.166': 0.16; 'subject:creation': 0.16; 'subject:variable': 0.16; 'meant': 0.17; 'wrote:': 0.18; 'seems': 0.20; 'to:2**1': 0.21; 'header:In-Reply- To:1': 0.22; 'dictionary': 0.23; 'besides': 0.24; 'function': 0.27; 'tried': 0.27; 'explicit': 0.29; 'problem': 0.29; 'example': 0.29; 'talked': 0.30; 'chris': 0.30; 'anyone': 0.31; 'cases': 0.32; "won't": 0.33; 'header:User-Agent:1': 0.33; 'to:addr:python- list': 0.34; 'someone': 0.34; 'nested': 0.34; 'thank': 0.35; 'google': 0.35; 'variables': 0.37; 'but': 0.37; 'problems': 0.37; 'doing': 0.38; 'using': 0.38; 'some': 0.38; 'subject:from': 0.38; 'help': 0.39; 'help!': 0.40; 'to:addr:python.org': 0.40; 'quick': 0.61; 'your': 0.61; 'received:websitewelcome.com': 0.64; 'received:184': 0.67; 'serious': 0.78; 'complex,': 0.84; 'trick,': 0.84; 'sum': 0.89; 'received:gateway04.websitewelcome.com': 0.91; 'speaks': 0.91; 'to:addr:msn.com': 0.96 |
| Date | Fri, 09 Dec 2011 12:01:01 -0800 |
| From | Ethan Furman <ethan@stoneleaf.us> |
| User-Agent | Thunderbird 1.5.0.10 (Windows/20070221) |
| MIME-Version | 1.0 |
| To | Massi <massi_srb@msn.com>, python-list@python.org |
| Subject | Re: Dynamic variable creation from string |
| References | <b078a04b-024b-48dc-b24a-8f4ce75fa238@13g2000vbu.googlegroups.com> <4edffed8$0$29988$c3e8da3$5496439d@news.astraweb.com> <mailman.3388.1323304088.27778.python-list@python.org> <qotobvjv3xj.fsf@ruuvi.it.helsinki.fi> <8ebfe32c-46a5-4bdc-a853-018d7f72d3d3@y18g2000yqy.googlegroups.com> |
| In-Reply-To | <8ebfe32c-46a5-4bdc-a853-018d7f72d3d3@y18g2000yqy.googlegroups.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-AntiAbuse | This header was added to track abuse, please include it with any abuse report |
| X-AntiAbuse | Primary Hostname - gator410.hostgator.com |
| X-AntiAbuse | Original Domain - python.org |
| X-AntiAbuse | Originator/Caller UID/GID - [47 12] / [47 12] |
| X-AntiAbuse | Sender Address Domain - stoneleaf.us |
| X-BWhitelist | no |
| X-Source | |
| X-Source-Args | |
| X-Source-Dir | |
| X-Source-Sender | mail.admailinc.com ([192.168.10.136]) [72.11.125.166]:2204 |
| X-Source-Auth | ethan+stoneleaf.us |
| X-Email-Count | 1 |
| X-Source-Cap | dG9idWs7dG9idWs7Z2F0b3I0MTAuaG9zdGdhdG9yLmNvbQ== |
| 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.3484.1323460660.27778.python-list@python.org> (permalink) |
| Lines | 25 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1323460660 news.xs4all.nl 6884 [2001:888:2000:d::a6]:43114 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:16931 |
Show key headers only | View raw
Massi wrote: > Thank you all for your replies, first of all my Sum function was an > example simplifying what I have to do in my real funciton. In general > the D dictionary is complex, with a lot of keys, so I was searching > for a quick method to access all the variables in it without doing the > explicit creation: > > a, b, c = D['a'], D['b'], D['c'] > > and without using directly the D dictionary (boring...). > When I talked about nested function I meant both cases Chris, but this > is not a really tighten bound. > I tried to follow the hints of Chris together with some help by google > and used the following code: > > for k in D : exec "%s = D[k]" %k > > That seems to do the trick, but someone speaks about "dirty code", can > anyone point me out which problems this can generate? > Again, thank you for your help! Besides the serious security issues, this method won't make the problem any better in Python 3. ~Ethan~
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Dynamic variable creation from string Massi <massi_srb@msn.com> - 2011-12-07 09:09 -0800
Re: Dynamic variable creation from string John Gordon <gordon@panix.com> - 2011-12-07 17:45 +0000
Re: Dynamic variable creation from string MRAB <python@mrabarnett.plus.com> - 2011-12-07 18:07 +0000
Re: Dynamic variable creation from string "Waldek M." <wm@localhost.localdomain> - 2011-12-07 18:46 +0100
Re: Dynamic variable creation from string Chris Angelico <rosuav@gmail.com> - 2011-12-08 04:52 +1100
Re: Dynamic variable creation from string Terry Reedy <tjreedy@udel.edu> - 2011-12-07 17:59 -0500
Re: Dynamic variable creation from string Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-08 00:03 +0000
Re: Dynamic variable creation from string Terry Reedy <tjreedy@udel.edu> - 2011-12-07 19:27 -0500
Re: Dynamic variable creation from string Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-08 01:59 +0000
Re: Dynamic variable creation from string Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2011-12-08 10:54 +0200
Re: Dynamic variable creation from string Massi <massi_srb@msn.com> - 2011-12-09 01:55 -0800
Re: Dynamic variable creation from string Peter Otten <__peter__@web.de> - 2011-12-09 12:27 +0100
Re: Dynamic variable creation from string Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-09 11:59 +0000
Re: Dynamic variable creation from string Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-09 12:03 +0000
Re: Dynamic variable creation from string Chris Angelico <rosuav@gmail.com> - 2011-12-09 23:08 +1100
Re: Dynamic variable creation from string Ethan Furman <ethan@stoneleaf.us> - 2011-12-09 12:01 -0800
Re: Dynamic variable creation from string Nobody <nobody@nowhere.com> - 2011-12-11 06:42 +0000
Re: Dynamic variable creation from string alex23 <wuwei23@gmail.com> - 2011-12-11 19:31 -0800
Re: Dynamic variable creation from string Ethan Furman <ethan@stoneleaf.us> - 2011-12-11 21:00 -0800
Re: Dynamic variable creation from string alex23 <wuwei23@gmail.com> - 2011-12-11 22:50 -0800
Re: Dynamic variable creation from string Chris Angelico <rosuav@gmail.com> - 2011-12-08 14:13 +1100
Re: Dynamic variable creation from string alex23 <wuwei23@gmail.com> - 2011-12-11 23:11 -0800
Re: Dynamic variable creation from string 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-12 04:43 -0800
Re: Dynamic variable creation from string 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-12 04:49 -0800
Re: Dynamic variable creation from string alex23 <wuwei23@gmail.com> - 2011-12-12 15:45 -0800
Re: Dynamic variable creation from string Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-13 01:35 +0000
Re: Dynamic variable creation from string 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-13 06:21 -0800
csiph-web