[Yum-devel] Re: basearchonly plugin
Matthew Miller
mattdm at mattdm.org
Tue Jul 24 20:01:36 UTC 2007
On Tue, Jul 24, 2007 at 08:57:34PM +0200, Adel Gadllah wrote:
> for userpkg in cmd:
> for skippkg in blacklist:
> if userpkg == skippkg:
> skip = 1
> if not re.search(regex, userpkg) and not skip:
> exclude.append(userpkg)
> skip = 0
How about:
for userpkg in cmd:
if not userpkg in blacklist and not re.search(regex, userpkg):
exclude.append(userpkg)
I'm not a python efficiency expert -- there's other structures that are
probably even better. And this same principle can be applied to your other
nested for-loop.
Also, naming the variable "regex" isn't very readable -- it's clearly a
regex given that you're passing it to re.search. And speaking of naming --
isn't your blacklist really a _whitelist_ -- a list of packages _not_ to
block?
--
Matthew Miller mattdm at mattdm.org <http://mattdm.org/>
Boston University Linux ------> <http://linux.bu.edu/>
More information about the Yum-devel
mailing list