Neal Becker 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?

No. e = blah will rebind the indentifier 'e' with 'blah' whatever that is. That is how python works.

Now, if e is mutable, say a list, you can do

   e.append(blah)

and, since the name 'e' is not being rebound, you would see the change in 'sequence'.

~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to