mirror of
https://github.com/satwikkansal/wtfpython
synced 2024-11-24 20:14:23 +01:00
Merge pull request #176 from larsks/fix/grammar
A minor grammar correction
This commit is contained in:
commit
e74ccb79d0
2
README.md
vendored
2
README.md
vendored
@ -1023,7 +1023,7 @@ Even when the values of `x` were different in every iteration prior to appending
|
|||||||
|
|
||||||
- When defining a function inside a loop that uses the loop variable in its body, the loop function's closure is bound to the variable, not its value. So all of the functions use the latest value assigned to the variable for computation.
|
- When defining a function inside a loop that uses the loop variable in its body, the loop function's closure is bound to the variable, not its value. So all of the functions use the latest value assigned to the variable for computation.
|
||||||
|
|
||||||
- To get the desired behavior you can pass in the loop variable as a named variable to the function. **Why this works?** Because this will define the variable again within the function's scope.
|
- To get the desired behavior you can pass in the loop variable as a named variable to the function. **Why does this work?** Because this will define the variable again within the function's scope.
|
||||||
|
|
||||||
```py
|
```py
|
||||||
funcs = []
|
funcs = []
|
||||||
|
Loading…
Reference in New Issue
Block a user