1 2 3 4 5 6 7 8 9 10 11 12 13
class User(object): def buy(self, what): if isinstance(what, (list, tuple)): for smth in what: smth.buy(self) else: what.buy(self) class Ware(object): is_bought = False def buy(self, who): self.is_bought = who