Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #8251

Re: writable iterators?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python@mrabarnett.plus.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'example:': 0.03; 'python': 0.08; 'from:addr:python': 0.09; 'readable': 0.09; 'wed,': 0.13; 'wrote:': 0.15; 'blah': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:name:mrab': 0.16; 'iterator': 0.16; 'iterators,': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'received:84.92': 0.16; 'received:84.92.122': 0.16; 'received:84.92.122.60': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'reply-to:addr :python-list': 0.16; '>>>': 0.16; 'meant': 0.17; 'say,': 0.19; 'loop': 0.22; 'header:In-Reply-To:1': 0.22; 'code.': 0.22; 'loop,': 0.23; 'objects,': 0.23; 'tried': 0.27; 'received:84': 0.28; 'elements': 0.29; 'example': 0.30; 'not.': 0.30; 'subject:?': 0.31; 'certainly': 0.32; 'references': 0.32; 'does': 0.33; 'header:User-Agent:1': 0.34; 'it?': 0.34; 'regardless': 0.34; 'to:addr:python-list': 0.34; 'reply-to:addr:python.org': 0.35; 'limitation': 0.37; 'sequence': 0.37; 'but': 0.37; 'steven': 0.38; 'something': 0.38; 'subject:: ': 0.38; 'allows': 0.39; 'to:addr:python.org': 0.39; 'did': 0.40; 'believe': 0.66; '"do': 0.67; 'jun': 0.67; 'header:Reply-To:1': 0.72; 'reply-to:no real name:2**0': 0.72; 'concept': 0.73; 'idiom': 0.84; 'sequence:': 0.84
X-IronPort-Anti-Spam-Filtered true
X-IronPort-Anti-Spam-Result AuIHADOJAk5UXebj/2dsb2JhbABTmEWOV3eIdcEKhi0Elk+LKA
Date Thu, 23 Jun 2011 01:34:50 +0100
From MRAB <python@mrabarnett.plus.com>
User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11
MIME-Version 1.0
To python-list@python.org
Subject Re: writable iterators?
References <mailman.296.1308770918.1164.python-list@python.org> <4e026497$0$29975$c3e8da3$5496439d@news.astraweb.com> <ittspg$5k2$1@dough.gmane.org>
In-Reply-To <ittspg$5k2$1@dough.gmane.org>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
Reply-To python-list@python.org
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.307.1308789287.1164.python-list@python.org> (permalink)
Lines 28
NNTP-Posting-Host 82.94.164.166
X-Trace 1308789287 news.xs4all.nl 14142 [::ffff:82.94.164.166]:50695
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:8251

Show key headers only | View raw


On 23/06/2011 00:10, Neal Becker wrote:
> Steven D'Aprano wrote:
>
>> On Wed, 22 Jun 2011 15:28:23 -0400, 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?
>>
>> Have you tried it? "e = blah" certainly does not "do nothing", regardless
>> of whether you are in a for loop or not. It binds the name e to the value
>> blah.
>>
>
> Yes, I understand that e = blah just rebinds e.  I did not mean this as an
> example of working code.  I meant to say, does Python have any idiom that allows
> iteration over a sequence such that the elements can be assigned?
>
[snip]
Python has references to objects, but not references to references.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

writable iterators? Neal Becker <ndbecker2@gmail.com> - 2011-06-22 15:28 -0400
  Re: writable iterators? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-06-22 21:54 +0000
    Re: writable iterators? Mel <mwilson@the-wire.com> - 2011-06-22 17:59 -0400
      Re: writable iterators? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-06-23 01:30 +0200
        Re: writable iterators? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-06-23 11:53 +1000
          Re: writable iterators? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-06-23 12:23 +0200
    Re: writable iterators? Neal Becker <ndbecker2@gmail.com> - 2011-06-22 19:10 -0400
      Re: writable iterators? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-06-23 11:50 +1000
    Re: writable iterators? MRAB <python@mrabarnett.plus.com> - 2011-06-23 01:34 +0100
    Re: writable iterators? Ian Kelly <ian.g.kelly@gmail.com> - 2011-06-23 09:02 -0600
    Re: writable iterators? Neal Becker <ndbecker2@gmail.com> - 2011-06-23 12:06 -0400
  Re: writable iterators? Chris Torek <nospam@torek.net> - 2011-06-23 18:26 +0000
    Re: writable iterators? Chris Torek <nospam@torek.net> - 2011-06-23 22:17 +0000
      Re: writable iterators? Neal Becker <ndbecker2@gmail.com> - 2011-06-23 21:10 -0400

csiph-web