On Tue, Jan 06, 2009 at 05:31:09PM -0600, Shawn Walker wrote: >> And I'd be wary of using regular expressions when speed is required, too. > > I'm not aware of a better option to perform the actual matching since the > python regex engine is written in C. I could probably perform the splits > of the version string manually though instead (my first version did that).
That's what I ended up doing for the version and fmri parsing. It was considerably faster, though perhaps some tweaking of the regexps would have been useful. But if you're concerned about speed, I'd just do some testing of the various options. >> Why would a separate class impact performance here? > > The usage of the class was murky to me. It seemed like I would have to > create an instance of the class for each comparison; but now I see that I > only need one instance for each version string and then I could use a > method off that for comparison with each fmri I retrieve from the catalog. > I could see possibly inheriting from MatchingPkgFmri and then adding a > "is_version_match" method or changing MatchingPkgFmri. > >>> However, I could be convinced that this should be a method on the PkgFmri >>> class, such as "is_matching_version" (name suggestions?). Would that >>> suffice? >> >> Why would you put a method on PkgFmri and not on Version? > > I'm confused now. MatchingPkgFmri inherits from PkgFmri. Should this be a > MatchingVersion class that inherits from Version instead? Yes. I don't get why this has anything to do with Fmri objects. Danek _______________________________________________ pkg-discuss mailing list [email protected] http://mail.opensolaris.org/mailman/listinfo/pkg-discuss
