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: remove() method is not working as expected(Hard to explain)
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.8
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: bjs, ctf.challenge.pushpam
Priority: normal Keywords:

Created on 2020-09-30 15:45 by ctf.challenge.pushpam, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
testtt.py ctf.challenge.pushpam, 2020-09-30 15:45 python file
Messages (2)
msg377708 - (view) Author: pushpam kumar (ctf.challenge.pushpam) Date: 2020-09-30 15:45
I am not able to understand why "password" word is not removed by remove() method
msg377710 - (view) Author: Ben (bjs) * Date: 2020-09-30 15:54
See the note in https://docs.python.org/3.7/reference/compound_stmts.html#the-for-statement "There is a subtlety when the sequence is being modified by the loop ..."

Since your code is mutating the  all_fields  list as you iterate it, you get the " next item will be skipped " behaviour, which is why the loop is skipping over "password".  remove() was never called to remove "password".

There is an open issue https://bugs.python.org/issue32767 to clarify the docs about this,  but it is not a bug in Python.
History
Date User Action Args
2022-04-11 14:59:36adminsetgithub: 86059
2020-09-30 17:07:13eric.smithsetstatus: open -> closed
type: behavior
resolution: not a bug
stage: resolved
2020-09-30 15:54:04bjssetnosy: + bjs
messages: + msg377710
2020-09-30 15:45:40ctf.challenge.pushpamcreate