Skip to content

no error when Final value reassigned in loop #2689

@KotlinIsland

Description

@KotlinIsland

Summary

from typing import Final

ABC: Final

for i in range(2):
    ABC = i  # expect error

but i hope that declaring a final variable in a loop is not removed:

for i in range(10):
  i_str: Final = str(i)  # i like that this is allowed, please don't remove it

Metadata

Metadata

Assignees

No one assigned

    Labels

    typing semanticstyping-module features, spec compliance, etc

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions