Re: ts.check() and ways of getting unresolved dependencies from a ts

Tres Seaver <[email protected]> Mon, 11 Oct 2004 12:38:33 -0400
Newsgroups gmane.linux.redhat.rpm.python
Organization Zope Corporation
Message-ID <[email protected]>
Paul Nasrat wrote:
> On Mon, Oct 11, 2004 at 11:21:33AM -0400, Sean Dilda wrote:
> 
>>On Mon, 2004-10-11 at 11:05, seth vidal wrote:
>>
>>
>>>We could also have ts.check() return a list of 'tsproblem' objects.
>>>
>>>These objects could have attributes like:
>>>problem.type - sense
>>>problem.need - needname/version/whatever
>>>problem.whatneeds - header object of the package that is 
>>>                    needed/conflicted, what have you
>>>
>>
>>For the most part, I like this idea.  Especially with special objects,
>>as opposed to just dictionaries (this is for cosmetic as well as
>>backwards compatibility reasons).
> 
> 
> I think list of objects is the way to go.
> 
> 
>>This reminds me of how the output of os.stat() was changed in the core
>>python libraries.  Originally it returned a tuple.  Not it returns an
>>object that acts much like you're describing.  But they also made it
>>backwards-compatible by making the new object indexable in the same way
>>the tuple was.  I suggest following their lead and have it return a list
>>of these new backwards-compatible objects.
> 
> 
> That sounds really nice. I'll look into implementation  of a pseudotuple. 
> 
> PyStructSequence seems the key - will fiddle.

You could just implement '__getitem__' in a Python class;  this is all 
Python expects for sequence objects.

Tres.
-- 
===============================================================
Tres Seaver                                [email protected]
Zope Corporation      "Zope Dealers"       http://www.zope.com