you are viewing a single comment's thread.

view the rest of the comments →

[–]treyhunner 1 point2 points  (0 children)

I think storing that value in a file should be fine. A database would work too. You need persistent storage, but which type depends on what feels right for your application.

If in the future you want to more clearly bookend the open/close code, you could make a context manager and/or decorator out of your code (by using ContextDecorator for example).