I have a program that I am writing in Python that does the following:
The user enters the name of the folder. Inside this folder are 8-15 .dat files with different extensions.
The program opens these data files, enters them into the SQL database, and then allows the user to select various changes made to the database. Then the database will be exported back to .dat files. There are about 5-10 different operations that can be performed.
What I planned during the design was to create a standard class for each group of files. The user will enter a folder name and an object with certain attributes (file names, file dictionary, file version (there are different versions), etc.). To determine these attributes, you must open several such files, read the file names, etc.
Should this action be performed in the __init__
method? Or should this action be performed on different instance methods that are called in the __init__
method? Or should these methods be located somewhere else and called only when the attribute is required elsewhere in the program?
I already wrote this program in Java. And I had a constructor that called other methods in the class to set the attributes of the object. But I was wondering what the standard practice in Python is.
source share