[issue4337] Iteration over a map object with list()

Jean-Michel Fauth report at bugs.python.org
Tue Nov 18 08:35:24 CET 2008


Jean-Michel Fauth <wxjmfauth at gmail.com> added the comment:

2008/11/17 Raymond Hettinger <report at bugs.python.org>

>
> Raymond Hettinger <rhettinger at users.sourceforge.net> 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 <report at bugs.python.org>
> <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 <report at bugs.python.org>
<http://bugs.python.org/issue4337>
_______________________________________
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: unnamed
URL: <http://mail.python.org/pipermail/python-bugs-list/attachments/20081118/452453fc/attachment.txt>


More information about the Python-bugs-list mailing list