Simon Forman wrote:
> Yes, you've got it, the xrange() version will not allocate a huge list.
>
> It's not part of your main question, and I understand that there may be
> reasons why you can't, but consider upgrading to 2.4 (or very soon now
> 2.5...)
upgrade to 2.4 is on the roadmap and will t
alf wrote:
> Simon Forman wrote:
> >>
> >>>|>> I = ([n] for n in i)
> >>
> >>This is nice but I am iterating thru hude objects (like MBs) so you know ...
> >>
> >
> > No, I don't know... :-)
>
> potentially my source lists are huge - so wanted to avoid unnecessary
> memory allocation
>
>
> > My fr
Paul Rubin wrote:
> alf <[EMAIL PROTECTED]> writes:
>
>>>|>> I = ([n] for n in i)
>>
>>This is nice but I am iterating thru hude objects (like MBs) so you know ...
>
>
> I don't understand the objection-- the above is entirely correct and
> produces the same iterator you'd get from
>
> def
Simon Forman wrote:
>>
>>>|>> I = ([n] for n in i)
>>
>>This is nice but I am iterating thru hude objects (like MBs) so you know ...
>>
>
> No, I don't know... :-)
potentially my source lists are huge - so wanted to avoid unnecessary
memory allocation
> My friend, I think you've misunderstood
alf wrote:
> Simon Forman wrote:
>
> >class LW(object): # ListWrapper
> >>... def __init__(self, i):
> >>... self.theiter = i
> >>... def next(self):
> >>... return [self.theiter.next()]
>
>
> I hoped one lamda would take care of it but looks like it is a simplest
> choi
alf <[EMAIL PROTECTED]> writes:
> > |>> I = ([n] for n in i)
>
> This is nice but I am iterating thru hude objects (like MBs) so you know ...
I don't understand the objection-- the above is entirely correct and
produces the same iterator you'd get from
def wrap(i):
for x in i:
Simon Forman wrote:
>class LW(object): # ListWrapper
>>... def __init__(self, i):
>>... self.theiter = i
>>... def next(self):
>>... return [self.theiter.next()]
I hoped one lamda would take care of it but looks like it is a simplest
choice.
> |>> I = ([n] for n in
John Machin wrote:
> alf wrote:
> > Hi,
> >
> > I have a following task: let's say I do have an iterator returning the
> > some objects:
> >
> > >>i=
> > >>i.next()
> > 1
> > >>i.next()
> > 'abgfdgdfg'
> > >>i.next()
> >
> >
> >
> > For some reason I need to wrap thos objects with a list. I th
alf wrote:
> Hi,
>
> I have a following task: let's say I do have an iterator returning the
> some objects:
>
> >>i=
> >>i.next()
> 1
> >>i.next()
> 'abgfdgdfg'
> >>i.next()
>
>
>
> For some reason I need to wrap thos objects with a list. I thought I
> could have a smart lamda or simple funct
Hi,
I have a following task: let's say I do have an iterator returning the
some objects:
>>i=
>>i.next()
1
>>i.next()
'abgfdgdfg'
>>i.next()
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:
10 matches
Mail list logo