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">&lt;<a href="mailto:[EMAIL PROTECTED]">[EMAIL 
PROTECTED]</a>&gt;</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 &lt;<a href="mailto:[EMAIL PROTECTED]">[EMAIL 
PROTECTED]</a>&gt; 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(). &nbsp;Either listing or for-looping<br>
will exhaust the iterator. &nbsp;This is how iterators work.<br>
<br>
----------<br>
nosy: +rhettinger<br>
resolution: &nbsp;-&gt; invalid<br>
status: open -&gt; closed<br>
<div><div></div><div class="Wj3C7c"><br>
_______________________________________<br>
Python tracker &lt;<a href="mailto:[EMAIL PROTECTED]">[EMAIL 
PROTECTED]</a>&gt;<br>
&lt;<a href="http://bugs.python.org/issue4337"; 
target="_blank">http://bugs.python.org/issue4337</a>&gt;<br>
_______________________________________<br>
</div></div></blockquote></div><br>Thanks for the reply and sorry for the 
noise. Indeed, you are right and for some &quot;strange personal reasons&quot; 
(bad habits?), I frequently fall in this trap.<br><br>&gt;&gt;&gt; def 
plus(i):<br>
&nbsp;&nbsp;&nbsp; return i + 1<br><br>&gt;&gt;&gt; list(map(plus, 
range(4)))<br>[1, 2, 3, 4]<br>&gt;&gt;&gt; <br><br>Regards<br><br>
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to