Hacker News new | past | comments | ask | show | jobs | submit login

The problem with contexts is that can't just innocently enter one in some if branch where the rest of the code would be scoped.

I ended up an OnExit() context that does:

    if conn is not None:
        ctx.call(conn.close)



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: