Regarding `with` and `else` in Python: 
    
    
    $ cat with_else.py
    with open("/etc/passwd") as fobj:
        pass
    else:
        pass
    
    $ python3.8 with_else.py
      File "with_else.py", line 3
        else:
        ^
    SyntaxError: invalid syntax
    
    
    Run

At least in the newest stable version it doesn't work. Maybe you confused it 
with `else` with `for` and `while`?

Anyway, although I see the usefulness of `else` for loops, I'm not a fan of it. 
;-)

Reply via email to