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.

classification
Title: List Comprehension Bug
Type: behavior Stage: resolved
Components: macOS Versions: Python 3.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: hyunjaemoon, ned.deily, ronaldoussoren, steven.daprano, tim.peters
Priority: normal Keywords:

Created on 2017-07-28 05:10 by hyunjaemoon, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
Screen Shot 2017-07-27 at 9.59.40 PM.png hyunjaemoon, 2017-07-28 05:10 Photo
Messages (3)
msg299363 - (view) Author: Hyun Jae Moon (hyunjaemoon) Date: 2017-07-28 05:10
Please check the photo attached.
This was tested on Python 3.6.0. It seems that there is a bug in list comprehension. The list b should include 84 as well according to the code I wrote. I believe this is a quite severe bug.
Thank you very much.
msg299364 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2017-07-28 05:27
This isn't a bug.  84 appears twice in the list, the first time at index 9.  The .index() method finds the first (leftmost; smallest index) occurrence.  Since 9 isn't even, the `if` test isn't satisfied, so 84 does not appear in the result.
msg299365 - (view) Author: Steven D'Aprano (steven.daprano) * (Python committer) Date: 2017-07-28 05:39
In the future, please do not post screenshots, please copy and paste the text. Screenshots are hard or impossible for the blind or visually impaired to see, but they can use a screen reader to work with text.
History
Date User Action Args
2022-04-11 14:58:49adminsetgithub: 75246
2017-07-28 05:39:01steven.dapranosetnosy: + steven.daprano
messages: + msg299365
2017-07-28 05:27:18tim.peterssetstatus: open -> closed

nosy: + tim.peters
messages: + msg299364

resolution: not a bug
stage: resolved
2017-07-28 05:10:01hyunjaemooncreate