Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bd4dd54

Browse files
committed
Issue #23589: Remove duplicate sentence from the FAQ. Patch by Yongzhi Pan.
1 parent 111803c commit bd4dd54

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

Doc/faq/programming.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,8 @@ What are the rules for local and global variables in Python?
187187
------------------------------------------------------------
188188

189189
In Python, variables that are only referenced inside a function are implicitly
190-
global. If a variable is assigned a new value anywhere within the function's
191-
body, it's assumed to be a local. If a variable is ever assigned a new value
192-
inside the function, the variable is implicitly local, and you need to
193-
explicitly declare it as 'global'.
190+
global. If a variable is assigned a value anywhere within the function's body,
191+
it's assumed to be a local unless explicitly declared as global.
194192

195193
Though a bit surprising at first, a moment's consideration explains this. On
196194
one hand, requiring :keyword:`global` for assigned variables provides a bar

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,8 @@ C API
396396
Documentation
397397
-------------
398398

399+
- Issue #23589: Remove duplicate sentence from the FAQ. Patch by Yongzhi Pan.
400+
399401
- Issue #24351: Clarify what is meant by "identifier" in the context of
400402
string.Template instances.
401403

0 commit comments

Comments
 (0)