In article ,
Terry Reedy wrote:
>
>Changing a list while iterating through it is possible, sometimes
>useful, but error prone, especially with insert or delete. Changing a
>dict while iterating through it is prohibited since the iteration order
>depends on the exact internal structure. That in
On Mon, 09 Aug 2010 09:11:37 -0700, daryn wrote:
> I'm just playing around with the iter function and I realize that I can
> use the iterator returned by it long after the original object has any
> name bound to it.
Yes, the same as everything else in Python. Iterators aren't unique here.
>>> a
On 8/9/2010 12:11 PM, daryn wrote:
I'm just playing around with the iter function and I realize that I
can use the iterator returned by it long after the original object has
any name bound to it. Example:
a=[1,2,3,4]
b=iter(a)
b.next()
1
a[1]=99
Changing a list while iterating through it i
daryn wrote:
> I'm just playing around with the iter function and I realize that I
> can use the iterator returned by it long after the original object has
> any name bound to it. Example:
>
a=[1,2,3,4]
b=iter(a)
b.next()
> 1
a[1]=99
a[3]=101
del a
b.next()
> 99
b
Alan G Isaac <[EMAIL PROTECTED]> writes:
If I have a sequence, I can get every other or every fifth
element by slicing. Is there an equivalent for iterators?
On 10/15/2008 11:12 PM Paul Rubin apparently wrote:
itertools.islice
Oh, of course.
I'm a bit embarrassed not to have thought
to lo
Alan G Isaac <[EMAIL PROTECTED]> writes:
> If I have a sequence, I can get every other or every fifth
> element by slicing. Is there an equivalent for iterators?
itertools.islice
--
http://mail.python.org/mailman/listinfo/python-list
En Sun, 24 Feb 2008 10:18:31 -0200, Dustan <[EMAIL PROTECTED]>
escribió:
> On Feb 24, 5:11 am, gert <[EMAIL PROTECTED]> wrote:
>> what is the difference between iter(lambda:f.read(8192), ') and
>> iter(f.read(8192),'') ?
>
> iter(lambda:f.read(8192), '') (what you probably meant) is what it
> lo
aha ok got it :)
--
http://mail.python.org/mailman/listinfo/python-list
On Feb 24, 5:11 am, gert <[EMAIL PROTECTED]> wrote:
> what is the difference between iter(lambda:f.read(8192), ') and
> iter(f.read(8192),'') ?
One does not work, and one is syntactically incorrect:
>>> iter(f.read(8192),'')
Traceback (most recent call last):
File "", line 1, in
iter(f.re
Will McGugan wrote:
> Hi,
>
> I've been using Python for years, but I recently encountered something
> in the docs I wasnt familar with. That is, using two arguements for
> iter(). Could someone elaborate on the docs and maybe show a typical use
> case for it?
>
>
> Thanks,
>
> Will McGugan
>
> --
Will McGugan wrote:
> Hi,
>
> I've been using Python for years, but I recently encountered something
> in the docs I wasnt familar with. That is, using two arguements for
> iter(). Could someone elaborate on the docs and maybe show a typical use
> case for it?
>
>
> Thanks,
>
> Will McGugan
>
> --
Will McGugan wrote:
> Hi,
>
> I've been using Python for years, but I recently encountered something
> in the docs I wasnt familar with. That is, using two arguements for
> iter(). Could someone elaborate on the docs and maybe show a typical use
> case for it?
>
>
> Thanks,
>
> Will McGugan
>
> --
12 matches
Mail list logo