One of my biggest gripes with python is the fact that the only way to create a local scope for variables is with functions.
I understand if statements not having their own scope for simplicity's sake, but the fact that `with` blocks don't is simply mind-bobbling to me.
```
with open("text.txt", 'w') as f:
f.write("hello world")
f.write("hello world") # at least the handle was automatically closed so it will give an IO error
```
I understand if statements not having their own scope for simplicity's sake, but the fact that `with` blocks don't is simply mind-bobbling to me. ``` with open("text.txt", 'w') as f: f.write("hello world") f.write("hello world") # at least the handle was automatically closed so it will give an IO error ```