[Sorry for over-quoting, I am not sure how to trim this properly]
Steven D'Aprano wrote:
On Thu, 23 Jun 2011 09:30 am Thomas 'PointedEars' Lahn wrote:
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
On Wed, Jun 22, 2011 at 3:54 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
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
Ian Kelly wrote:
On Wed, Jun 22, 2011 at 3:54 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
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
(I apologize for the length of this article -- if I had more time,
I could write something shorter...)
In article mailman.296.1308770918.1164.python-l...@python.org
Neal Becker ndbeck...@gmail.com wrote:
AFAICT, the python iterator concept only supports readable iterators,
not write.
Is this
In article iu00fs1...@news3.newsguy.com I wrote, in part:
Another possible syntax:
for item in container with key:
which translates roughly to bind both key and item to the value
for lists, but bind key to the key and value for the value for
dictionary-ish items. Then ... the OP would
Chris Torek wrote:
In article iu00fs1...@news3.newsguy.com I wrote, in part:
Another possible syntax:
for item in container with key:
which translates roughly to bind both key and item to the value
for lists, but bind key to the key and value for the value for
dictionary-ish items. Then
On Wed, Jun 22, 2011 at 12:28 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
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
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
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
... print(e)
...
1
42
2
42
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
:
... print(e)
... e = 42
... print(e)
...
1
42
2
42
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
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
You could probably implement something like this using generators and the
send method (note the example is untested and intended for 2.6: I lack
Python on this machine):
def gen(list_):
for i, v in enumerate(list_):
list_[i] = yield v
def execute():
data = range(10)
iterator =
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
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 #
On Thu, 23 Jun 2011 09:10 am 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
On Thu, 23 Jun 2011 09:30 am Thomas 'PointedEars' Lahn wrote:
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
On Wednesday, June 22, 2011 4:10:39 PM UTC-7, Neal Becker wrote:
AFAIK, the above is the only python idiom that allows iteration over a
sequence
such that you can write to the sequence. And THAT is the problem. In many
cases, indexing is much less efficient than iteration.
Well, if your
Don't relate it anyhow to foreach of perl I would say, although the behaviour
may be same in some aspect
--
http://mail.python.org/mailman/listinfo/python-list
20 matches
Mail list logo