I know its probably early stages, but in the code
class Espresso(Decorator):
cost = 0.75f
description = " espresso"
public Espresso(DrinkComponent):
Decorator.__init__(self, component)
the 0.75f doesn't compile in python 2.1, nor does the keyword public.
Class attributes are found by the instance attribute look-up rules rather than the plain symbol look-ups.
Should be:
def getTotalCost(self):
return self.component.getTotalCost() + self.cost
def getDescription(self):
return self.component.getDescription() +
self.description
The constructor should probably be:
def __init__(self, drinkComponent):
self.component = drinkComponent
(as in the next paragraph)