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           [EMAIL PROTECTED]          <http://mattdm.org/>
Boston University Linux      ------>              <http://linux.bu.edu/>
_______________________________________________
Yum-devel mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/yum-devel

Reply via email to