books.py
import sqlite3 db = sqlite3.connect('bookshop.db') db.close()
Core Activities:
Extension Activities:
"When SQLite connection is closed explicitly by code or implicitly by program exit then any outstanding transaction is rolled back. (The rollback is actually done by the next program to open the database.) If there is no outstanding transaction open then nothing happens."
Considering this, do you think you need thedb.close()
, or is it simply good practise to do so? Discuss.