[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-list
Subject:    Re: Performance
From:       "Steve Purcell" <stephen_purcell () yahoo ! com>
Date:       2000-07-04 12:34:53
[Download RAW message or body]

Horst Gassner <horst@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



-- 
http://www.python.org/mailman/listinfo/python-list

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic