[Zope-dev] New IOBTrees have no 'map' method

Chris McDonough chrism@digicool.com
Fri, 11 May 2001 08:59:46 -0400


Chris Withers wrote:
> 
> "R. David Murray" wrote:
> >
> > My guess, after searching for the keyword 'map' and finding an
> > interface that calls for the implementation of __getitem__ and says
> > this allows 'for' loops and 'map' iterations, is that you can just
> > drop the call to the .map method and use the IOBtree directly as
> > the argument to the map function.  But in the absence of real
> > knowledge about what the .map method of the old IOBTree does, that
> > is just a guess.
> 
> Well, to give you an idea of what it did, here's the method I had to write
> toreplace the functionality:
> 
>     def data_map(self,ids):
>         result=[]
>         for id in ids:
>             result.append(self.data[id].__of__(self))
>         return result
> 
> self.data is an IOBTree.
> 
> If this can be replaced wiith a simple return map(...,self.data), please let me
> know :-)
> 

Untested...

return map(lambda x, data=self.data, self=self: data[x].__of__(self),
ids)