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


Groups > comp.lang.python > #8250

Re: writable iterators?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!2a02:590:1:1::196.MISMATCH!news.teledata-fn.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail
Content-Type text/plain; charset="ISO-8859-1"
Message-Id <2372171.ArG6xLiZAS@PointedEars.de>
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Reply-To Thomas 'PointedEars' Lahn <usenet@PointedEars.de>
Organization PointedEars Software (PES)
Date Thu, 23 Jun 2011 01:30:13 +0200
User-Agent KNode/4.4.7
Content-Transfer-Encoding 7Bit
Subject Re: writable iterators?
Newsgroups comp.lang.python
References <mailman.296.1308770918.1164.python-list@python.org> <4e026497$0$29975$c3e8da3$5496439d@news.astraweb.com> <ittokg$r6n$1@speranza.aioe.org>
Followup-To comp.lang.python
MIME-Version 1.0
Lines 33
NNTP-Posting-Date 23 Jun 2011 01:30:13 CEST
NNTP-Posting-Host 77566dac.newsspool3.arcor-online.net
X-Trace DXC=^3GXSXa?l9JAa;:RKVJ>LEMcF=Q^Z^V3H4Fo<]lROoRA8kF<OcfhCOKa`:6Ko^Zg`LDZm8W4\YJNLT<8F<]0D<`If]]K;\T]JC@m8DKVmk7YFA
X-Complaints-To usenet-abuse@arcor.de
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:8250

Followups directed to: comp.lang.python

Show key headers only | View raw


Mel wrote:

> Steven D'Aprano wrote:
>> I *guess* that what you mean by "writable iterators" is that rebinding e
>> should change seq in place, i.e. you would expect that seq should now
>> equal [42, 42]. Is that what you mean? It's not clear.
>> 
>> Fortunately, that's not how it works, and far from being a "limitation",
>> it would be *disastrous* if iterables worked that way. I can't imagine
>> how many bugs would occur from people reassigning to the loop variable,
>> forgetting that it had a side-effect of also reassigning to the iterable.
>> Fortunately, Python is not that badly designed.
> 
> And for an iterator like
> 
> def things():
>     yield 1
>     yield 11
>     yield 4
>     yield 9
> 
> I don't know what it could even mean.

<http://docs.python.org/reference/simple_stmts.html#the-yield-statement>

You could have tried to debug.

Please trim your quotes to the relevant minimum.

-- 
PointedEars

Bitte keine Kopien per E-Mail. / Please do not Cc: me.

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