Re: [Tutor] Overloading comparisons

2005-11-15 Thread Hugo González Monteverde
Hi Danny, That's nice. I do think I'm going this way I don't want the container to grow too big in memory, not bigger than 1k elements(it is a cache), but when deleting an element I need it to be the oldest files (again, because it is a cache) Thanks for the advice, I'm going this way. My OOP

Re: [Tutor] Overloading comparisons

2005-11-15 Thread Danny Yoo
> I defined an object wich describes a video clip, like this > > class VideoSegment: > def __init__(self, filename): > # Attributes that have to be present > self.filename = filename [some text cut] > I can define the following for sorting the array: [some code cut] > B

Re: [Tutor] Overloading comparisons

2005-11-15 Thread Hugo González Monteverde
I know it is rude to reply to myself. But I found the answer and wanted to share it. I did the following test: >>> class Lala: ... def __eq__(self, other): ... if self.name == other.name: ... return True ... ... def __cmp__(self, other): ... if self.time < ot

[Tutor] Overloading comparisons

2005-11-15 Thread Hugo González Monteverde
Hi all, I defined an object wich describes a video clip, like this class VideoSegment: def __init__(self, filename): # Attributes that have to be present self.filename = filename The thing is, I will define an array of these objects for a cache, and would like to keep th