REPOST: Re: Paramaterized local variable name

Tim Cera timcera at earthlink.net
Sun Dec 30 15:34:52 CET 2001


Hans Nowak <wurmy at earthlink.net> wrote
> You probably want
> 
>   start = getattr(data[key][i], local_name)
> 
> Now you can set local_name to a string "name" or "rev"
> or whatever attribute of data[key][i] you want to
> access.

Works great!

THANKS!

Thanks also to Sean for the 'exec' based solution.

take care
Tim Cera

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!news.maxwell.syr.edu!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: timcera at earthlink.net (Tim Cera)
Newsgroups: comp.lang.python
Subject: cmsg cancel <9c3f2e9c.0112300634.6e2c1ef6 at posting.google.com>
Control: cancel <9c3f2e9c.0112300634.6e2c1ef6 at posting.google.com>
Date: Mon, 31 Dec 2001 03:05:55 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: <cancel.9c3f2e9c.0112300634.6e2c1ef6 at posting.google.com>
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009774221 27193 211.57.49.2 (31 Dec 2001 04:50:21 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 04:50:21 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.



More information about the Python-list mailing list