Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def get_db():
- db = getattr(get_db, 'db', db_connection())
- get_db.db = db
- return db
- def func1():
- db = get_db()
- db.execute('SELECT * FROM things')
- def func2():
- db = get_db()
- db.execute('SELECT * FROM other_things')
Add Comment
Please, Sign In to add comment