Can I do this faster?
Alex
cut_me_out at hotmail.com
Wed Aug 9 07:46:30 EDT 2000
You could try something like this:
from operator import getitem
def __GetRowID(s, row):
values = s.__rowDict.values()
data = map(getitem, values, len(values)*['data'])
try:
index = data.index(row)
except ValueError:
return None
key = s.__rowDict.keys()[index]
return key
If s isn't changing very much, it might help to cache data and
s.__rowDict.keys() I guess that would be the expensive part of doing it
this way.
Alex.
More information about the Python-list
mailing list