writable iterators?

Dan Stromberg drsalists at gmail.com
Thu Jun 23 22:09:38 EDT 2011


On Wed, Jun 22, 2011 at 12:28 PM, Neal Becker <ndbecker2 at gmail.com> wrote:

> AFAICT, the python iterator concept only supports readable iterators, not
> write.
> Is this true?
>
> for example:
>
> for e in sequence:
>  do something that reads e
>  e = blah # will do nothing
>
> I believe this is not a limitation on the for loop, but a limitation on the
> python iterator concept.  Is this correct?
>

The Generators, Iterators and Comprehensions 2011 document at the URL below
covers a way of doing this.

http://stromberg.dnsalias.org/~dstromberg/Intro-to-Python/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110623/f8abd3dd/attachment.html>


More information about the Python-list mailing list