I am trying to encode a very rudimentary GTD application for myself, not just to organize myself, but to better understand the encoding and become better in Python. However, I have problems with classes.
Here are the classes that I still have:
class Project:
def __init__(self, name, actions=[]):
self.name = name
self.actions = actions
def add(self, action):
self.actions.append(action)
class Action:
def __init__(self, do='', context=''):
self.do = do
self.context = context
Each project has actions for it, but I want to make it so that projects can also consist of other projects. Say every day I wanted to print a list of everything. I'm having problems with how I built a list similar to this
> Project A
> Actions for Project A
> Project B
> Sub project A
> Actions for Sub project A
> Sub project B
> Actions for Sub project B
> Sub project C
> Sub sub project A
> Actions for sub sub project A
> Sub sub project B
> Actions for sub sub project B
> Actions for Sub project C
> Actions for Project B
It is clear to me that recursion will be used. I'm struggling with whether to create another class for it, a subproject and a subclass of Project. Something there just makes my brain throw an exception.
action Project, , MegaProject.actions.action.actions.action.
- , !