[Yum-devel] standardize on a package object?

Menno Smits menno-yum at freshfoo.com
Mon Aug 21 13:03:24 UTC 2006


seth vidal wrote:
>> Shouldn't we just make the objects comparable by rich comparison 
>> methods?
>> 
>> __lt__( self, other) __le__( self, other) __eq__( self, other) 
>> __ne__( self, other) __gt__( self, other) __ge__( self, other
>> 
>> Alternatively we could use an approach similar to that in sets.Sets
>> 
>> 
> 
> Except that it's not quite that simple, for most of the objects.
> 
> b/c we need to compare different things.
> 
> sometimes were comparing "which one of these versions is newer"
> 
> and sometimes were comparing "which one of these packages is
> 'better'"
> 
> ie: which arch is better for this situation which package name is
> shorter (sigh)
> 
> So I'm not sure how we could fairly use the rich comparison methods
> for all of these multiple comparisons.

The rich comparison methods do make things nicer. What if the
comparison methods are implemented for the "which one of these is
newer" situation? This is the most intuitive comparision IMHO.

The high level package ops module could implement anything else
that's required. The implementations for the rich comparison methods
would just call functions in this module to do the actual work.

Menno





More information about the Yum-devel mailing list