My code is :
class Handler():
# make it static
from pymongo import MongoClient
client = MongoClient("localhost", 27017)
db = client.newsdb
news = db.news
I want to make the client variable to be static, so is above code the correct way to do that ? I also want to use singleton pattern, because maybe the MongoClient is very large element, and I want to new() this element when I really need it....
How can I do that in python ? As a beginner, maybe ask some stupid question, sorry for that in advance...