Performance
Steve Purcell
stephen_purcell at yahoo.com
Tue Jul 4 08:34:53 EDT 2000
Horst Gassner <horst at p...> wrote:
> The following function is one of the slower ones and I would be
happy if
> there are any possibilties to speed this thing up.
>
> subItems = {}
> if s.__subList[level] :
> for key in s.__subList[level].keys ():
> # root level is special case!
> # get all sublevels without recognizing id of sublevel
> if level==0 or string.find(key, id) == 0 :
> subItems[key] = s.__subList[level][key]
How about:
subItems = {}
if s.__subList[level]:
for key,value in s.__subList[level].items():
if not level or not string.find(key,id):
subItems[key] = value
--
Steve Purcell, Technical Director, Inkontact
Get in touch at http://www.inkontact.com/
"Life must be simple if I can do it" -- Me
More information about the Python-list
mailing list