#!/usr/bin/python from mytraits import Trait, TraitUser class TWalker(Trait): def walk(self): print "walking" class TWalker2(Trait): def walk(self): print "walking2" class TGruiker(Trait): __uses__ = TWalker, def gruik(self): print "gruik" class TPloper(Trait): def plop(self): print "ploping" class TMooher(Trait): __uses__ = TGruiker, def talk(self): print "moohing" class ConflictingWalker(TraitUser): __uses__ = TWalker, TWalker2 def walk(self): print "conflictingWalker walks" class StrangeAnimal(TraitUser): __uses__ = TMooher, TPloper.alias({"tplop":"plop"}) # def plop(self): # print "strange animal is ploping" class Duck(StrangeAnimal): __uses__ = TPloper, if __name__ == "__main__": # when run as a script cw = ConflictingWalker() cw.walk() print type(TPloper.alias({"tplop":"plop"})) sa = StrangeAnimal() #print dir(sa) sa.plop() sa.talk() d = Duck() d.talk() d.plop()