I want to create a singleton class that collects data from a csv file, and for this it needs to have a data member of type DictReader; but I'm not sure how to initialize this member in the class definition, since it can be initialized as follows:
with open('sourceFile.csv') as source:
reader = csv.DictReader(source)
Since Python will not allow you to declare variables without initialization, I need to know how I can initialize a reader object in the Singleton class.
source
share