'Python proper inheritance structure
I'm trying to write an application which will take data from different sources and store it in one main class which will be able to send it to further users.
For example:
- app.py - main file with variables: data (list) and methods: print_data, update_data
- source1.py - file with class which will inherit from app.py and will store implementation of scraping data form source1
- source2.py - file with class which will inherit from app.py and will store implementation of scraping data form source2
- etc...
All the sources files should be able to use the same data from app.py so if source1 appends smth to the data, source2 should have the change too. I should be able to print the data in infinite loop from app.py I would like to my app.py file start all the sources scrapers (source1.py, source2.py etc.).
How do I implement that app?
I was trying to write some code but I'm stuck:
app.py imports source1.py to get init method and start app in different thread and source1.py imports app.py to get access to the update_data method from app.py. It leads to circular import error.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
