Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
Semaphor
on Oct 11, 2022
|
parent
|
context
|
favorite
| on:
Go: Redefining For Loop Variable Semantics
If I do the same with for instead of foreach in C#, my IDE gives me a warning: "Captured variable is modified in the outer scope". Isn’t that the case for Python?
ketzu
on Oct 11, 2022
|
next
[–]
Copy pasting OPs code to pycharm: No warning.
jstx1
on Oct 11, 2022
|
parent
|
next
[–]
Pylint catches it -
https://pylint.pycqa.org/en/latest/user_guide/messages/warni...
Semaphor
on Oct 11, 2022
|
parent
|
prev
|
next
[–]
Probably worthy of a YouTrack report ;)
maxloh
on Oct 11, 2022
|
prev
[–]
I don't think it is a good practice to capture it in lint tooling, instead of by the language itself.
Semaphor
on Oct 12, 2022
|
parent
[–]
It’s what linters are great at, catch things that work the way you don’t expect.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: