[Yum-devel] *sack.matchPackages()

Jeremy Katz katzj at redhat.com
Mon Aug 28 12:56:21 UTC 2006


On Sun, 2006-08-27 at 16:28 -0400, seth vidal wrote:
> On Sun, 2006-08-27 at 16:22 -0400, seth vidal wrote:
> > I was considering making matchPackages() into a generator to lighten up
> > the load on memory. However, with it returning 3 lists I have no idea
> > how it can be a generator and I'm open to suggestions for redesigning
> > this.
> > 
> > can the yield operator return 3 objects?
> > 
> > yield this_exact_match, None, None
> > yield None, this_glob_match, None
> > yield None, None, unmatched_string
>
> Something that might work.
> Instead of returning the 3 lists
> for each match return an 3 item tuple
> (pkgmatch, matchedwith, typeofmatch)

Alternately, what do we gain by having it return both the exact and
globbed matches from the same function?  From an API standpoint, it
almost seems cleaner to have differing functions for each because then
it's a bit more clear what each is doing.

> We'd have to modify every location where we use this method but it might
> work out.

No matter what, as long as we have all of the same functionality, we
could have parsePackages() keep the legacy behavior and mark it
deprecated -- then, convert all the known stuff and we get the benefit
without breaking everyone :-)

Jeremy




More information about the Yum-devel mailing list