REPOST: Paramaterized local variable name
Tim Cera
timcera at earthlink.net
Sun Dec 30 00:15:56 EST 2001
Hello,
I have the following code:
def paging(data, key, query_dict):
for i in range(0, len(data[key]), use_pagesize):
start = data[key][i].name
...etc.
which works fine for data[key][i].name, but sometimes I want this
function to process data[key][i].rev.
So, if local_name is equal to 'name' or 'rev' or 'whatever', what I
want is something like:
def paging(data, key, query_dict, local_name):
for i in range(0, len(data[key]), use_pagesize):
start = data[key][i].
# What goes here ^^^^ ?
Thanks
Tim Cera
========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!t-online.de!newsfeed.gamma.ru!Gamma.RU!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: timcera at earthlink.net (Tim Cera)
Newsgroups: comp.lang.python
Subject: cmsg cancel <9c3f2e9c.0112292115.6a4e22af at posting.google.com>
Control: cancel <9c3f2e9c.0112292115.6a4e22af at posting.google.com>
Date: Mon, 31 Dec 2001 01:10:31 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: <cancel.9c3f2e9c.0112292115.6a4e22af at posting.google.com>
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009774389 27193 211.57.49.2 (31 Dec 2001 04:53:09 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 04:53:09 +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