On Jun 22, 2011 12:31 PM, "Neal Becker" <ndbeck...@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?
consider the following code x = [1,2,3] y = x[0] y = 5 Would you expect x to be [5,2,3] now? Assignment in python assigns a name to an object. It doesn't change the value of a variable. If you have a generator, you can use send() to put data in you need the actual generator itself to do that. > > -- > http://mail.python.org/mailman/listinfo/python-list
-- http://mail.python.org/mailman/listinfo/python-list