Re: Replacing Axiom Lists with a new list of Items

Robert Gravina <[email protected]> Sun, 2 Jul 2006 04:50:36 +0900
Newsgroups gmane.comp.python.quotient.dev
Message-ID <[email protected]>
On 2006/07/02, at 4:44, Jean-Paul Calderone wrote:

[snip]

> Using a simpler one-to-many relation than the one List uses.  For  
> example:
>
> class ContainerRelation(Item):
>    container = reference()
>    containee = reference()
>
> class ContainerItem(Item):
>    def add(self, item):
>        ContainerRelation(store=self.store,
>                          container=self,
>                          containee=item)
>
>    def __iter__(self):
>        contents = self.store.query(
>            ContainerRelation,
>            ContainerRelation.container == self)
>        for relation in contents:
>            yield relation.containee


Ah great! Thanks, it's beginning to make more sense now. I will use  
that instead.