This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jmfauth
Recipients jmfauth, rhettinger
Date 2008-11-18.07:35:23
SpamBayes Score 3.354641e-07
Marked as misclassified No
Message-id <46fcc31b0811172335l95fa7b6q8c849d258c3acc1b@mail.gmail.com>
In-reply-to <1226937965.43.0.385534886464.issue4337@psf.upfronthosting.co.za>
Content
2008/11/17 Raymond Hettinger <report@bugs.python.org>

>
> Raymond Hettinger <rhettinger@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@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
Files
File name Uploaded
unnamed jmfauth, 2008-11-18.07:35:21
History
Date User Action Args
2008-11-18 07:35:24jmfauthsetrecipients: + jmfauth, rhettinger
2008-11-18 07:35:23jmfauthlinkissue4337 messages
2008-11-18 07:35:23jmfauthcreate