Steve D'Aprano wrote:
There are a very few exceptions to this rule of thumb, such as opening connections to databases or files or similar.
Another way to handle that is to have the connection method return another object that has the methods that should only be called for active connections. That way it's not possible to do things out of sequence. -- Greg -- https://mail.python.org/mailman/listinfo/python-list