iterator wrapper

alf ask at me
Fri Aug 11 18:22:09 EDT 2006


Hi,

I have a following task: let's say I do have an iterator returning the 
some objects:

 >>i=<iterator>
 >>i.next()
1
 >>i.next()
'abgfdgdfg'
 >>i.next()
<some object>


For some reason I need to wrap thos objects with a list. I thought I 
could have a smart lamda or simple function class yielding following result:


 >>i=<iterator>
 >>i=list_wrapper(i)
 >>i.next()
[1]
 >>i.next()
['abgfdgdfg']
 >>i.next()
[<some object>]


What would thesolution?


Thx,

A.



More information about the Python-list mailing list