[issue30826] More details in reference 'Looping through a list in Python and modifying it'

2020-09-03 Thread Roundup Robot
Change by Roundup Robot : -- nosy: +python-dev nosy_count: 5.0 -> 6.0 pull_requests: +21165 pull_request: https://github.com/python/cpython/pull/22078 ___ Python tracker ___ __

[issue30826] More details in reference 'Looping through a list in Python and modifying it'

2019-08-22 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset b6341e676af2f58f3ad9b51a0d2fb7db5a3428e3 by Raymond Hettinger (Miss Islington (bot)) in branch '3.8': bpo-30826: Improve control flow examples (GH-15407) (GH-15410) https://github.com/python/cpython/commit/b6341e676af2f58f3ad9b51a0d2fb7db5a34

[issue30826] More details in reference 'Looping through a list in Python and modifying it'

2019-08-22 Thread Raymond Hettinger
Change by Raymond Hettinger : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___

[issue30826] More details in reference 'Looping through a list in Python and modifying it'

2019-08-22 Thread miss-islington
Change by miss-islington : -- pull_requests: +15115 pull_request: https://github.com/python/cpython/pull/15410 ___ Python tracker ___ __

[issue30826] More details in reference 'Looping through a list in Python and modifying it'

2019-08-22 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 6fcb6cfb139ade1aac6dbee0b18ca72b18cbe0d2 by Raymond Hettinger in branch 'master': bpo-30826: Improve control flow examples (GH-15407) https://github.com/python/cpython/commit/6fcb6cfb139ade1aac6dbee0b18ca72b18cbe0d2 --

[issue30826] More details in reference 'Looping through a list in Python and modifying it'

2019-08-22 Thread Raymond Hettinger
Change by Raymond Hettinger : -- keywords: +patch pull_requests: +15112 stage: -> patch review pull_request: https://github.com/python/cpython/pull/15407 ___ Python tracker __

[issue30826] More details in reference 'Looping through a list in Python and modifying it'

2017-09-24 Thread Terry J. Reedy
Terry J. Reedy added the comment: I agree that the tutorial For section needs be updated to include non-sequences. A dict example will help with that. I agree that the unrealistic insert mis-directs attention and like Raymond's replacement. ['users.copy()' should be 'users.copy().items'] ---

[issue30826] More details in reference 'Looping through a list in Python and modifying it'

2017-09-24 Thread Raymond Hettinger
Raymond Hettinger added the comment: After looking at this again, I think the entire example should be removed. We really don't want to encourage people to code like this (it would never make it through a code review). The example itself is silly (not fully, just weird and lacking real-world

[issue30826] More details in reference 'Looping through a list in Python and modifying it'

2017-07-12 Thread R. David Murray
R. David Murray added the comment: I don't think that helps. The issue here is that *sequences* are iterated over by incrementing an integer index. If you change the size of the list, you are potentially changing which value any given index points to. Presumably the tutorial writer thought

[issue30826] More details in reference 'Looping through a list in Python and modifying it'

2017-07-07 Thread Terry J. Reedy
Terry J. Reedy added the comment: Are you looking for something like: Let it = iter(words). When next(it) returns 'defenestrate', insertion at the beginning moves the original 'defenestrate' over so that next(words) returns 'defenestrate' again. ? -- nosy: +terry.reedy _

[issue30826] More details in reference 'Looping through a list in Python and modifying it'

2017-07-03 Thread Anmol Gupta
Anmol Gupta added the comment: And also a small explanation for why there would be an infinite loop without creating a copy. -- ___ Python tracker ___ __

[issue30826] More details in reference 'Looping through a list in Python and modifying it'

2017-07-02 Thread Raymond Hettinger
Raymond Hettinger added the comment: The example would be more clear if we replaced the opaque idiom "words[:]" with the more explicit alternative "words.copy()". -- assignee: docs@python -> rhettinger nosy: +rhettinger ___ Python tracker

[issue30826] More details in reference 'Looping through a list in Python and modifying it'

2017-07-01 Thread Anmol Gupta
Anmol Gupta added the comment: Wrong documentaion section linked. Correct seciton: Section 4.2 on https://docs.python.org/3/tutorial/controlflow.html The last line needs more explanation. -- ___ Python tracker _

[issue30826] More details in reference 'Looping through a list in Python and modifying it'

2017-07-01 Thread Anmol Gupta
New submission from Anmol Gupta: Documentation section: https://docs.python.org/3/reference/compound_stmts.html#for The documentation does not explain at all why is there an infinite loop when not using a copy of the list. It leaves the reader in a confused state. Even there are questions co

[issue30826] More details in reference 'Looping through a list in Python and modifying it'

2017-07-01 Thread Anmol Gupta
Changes by Anmol Gupta : -- assignee: docs@python components: Documentation nosy: Anmol Gupta, docs@python priority: normal severity: normal status: open title: More details in reference 'Looping through a list in Python and modifying it' type: enhancement versions: Python 3.6