Skip to content

Feature request: trying to change the index variable in a for loop #11

@tukkek

Description

@tukkek

Hello! After finding a link to your project today on reddit I have decided to give another go at a previous project of mine, now using your document format as inspiration! While doing my research I have come across something that I think would fit well in your list. Here it is:

for i in range(10):
    print(i)
    i = 5             # this will not affect the for-loop
                      # because i will be overwritten with the next
                      # index in the range

This is taken from the Python manual itself, which in itself makes it notable. This might not come as a surprise to anyone who started coding with Python - but for people coming from C++, Java or similar, this is very much something they'd expect to work, giving how for loops work in these languages.

Hope you like this :) Source: https://docs.python.org/3/reference/compound_stmts.html#the-for-statement

By the way, if you have the time to read my own work and maybe let me know if I'm missing anything, I'd be very honored to have you onboard! Here is the link for my current work-in-progress version: https://github.com/tukkek/notablepython/blob/master/README.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions