Description
Lets you compose objects into tree structures and then work with these structures as if they were individual objects.
Where to use
- File systems. \n
- GUI element trees.
Real World Example
A 'Folder' contains 'Files' and other 'Folders'. You can call 'getSize()' on a Folder, and it recursively calculates the size of everything inside.
Code Example
class Composite:
def __init__(self):
pass
def execute(self):
print('Executing Composite')
