Jean-Michel Fauth <[EMAIL PROTECTED]> added the comment:
2008/11/17 Raymond Hettinger <[EMAIL PROTECTED]>
>
> Raymond Hettinger <[EMAIL PROTECTED]> added the comment:
>
> Feature :-)
>
> You will get the expected result if you skip the step where you ran the
> for-loop over r before running list(). Either listing or for-looping
> will exhaust the iterator. This is how iterators work.
>
> ----------
> nosy: +rhettinger
> resolution: -> invalid
> status: open -> closed
>
> _______________________________________
> Python tracker <[EMAIL PROTECTED]>
> <http://bugs.python.org/issue4337>
> _______________________________________
>
Thanks for the reply and sorry for the noise. Indeed, you are right and for
some "strange personal reasons" (bad habits?), I frequently fall in this
trap.
return i + 1
[1, 2, 3, 4]
>>>
Regards
Added file: http://bugs.python.org/file12039/unnamed
_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue4337>
_______________________________________
<br><br><div class="gmail_quote">2008/11/17 Raymond Hettinger <span
dir="ltr"><<a href="mailto:[EMAIL PROTECTED]">[EMAIL
PROTECTED]</a>></span><br><blockquote class="gmail_quote"
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex;
padding-left: 1ex;">
<br>
Raymond Hettinger <<a href="mailto:[EMAIL PROTECTED]">[EMAIL
PROTECTED]</a>> added the comment:<br>
<br>
Feature :-)<br>
<br>
You will get the expected result if you skip the step where you ran the<br>
for-loop over r before running list(). Either listing or for-looping<br>
will exhaust the iterator. This is how iterators work.<br>
<br>
----------<br>
nosy: +rhettinger<br>
resolution: -> invalid<br>
status: open -> closed<br>
<div><div></div><div class="Wj3C7c"><br>
_______________________________________<br>
Python tracker <<a href="mailto:[EMAIL PROTECTED]">[EMAIL
PROTECTED]</a>><br>
<<a href="http://bugs.python.org/issue4337"
target="_blank">http://bugs.python.org/issue4337</a>><br>
_______________________________________<br>
</div></div></blockquote></div><br>Thanks for the reply and sorry for the
noise. Indeed, you are right and for some "strange personal reasons"
(bad habits?), I frequently fall in this trap.<br><br>>>> def
plus(i):<br>
return i + 1<br><br>>>> list(map(plus,
range(4)))<br>[1, 2, 3, 4]<br>>>> <br><br>Regards<br><br>
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com