Anybody have an idea for how to do python mixins that don't down-call?

Thanks

(
Mixins from different vendors might use the same method names for unrelated
features, but should continue to work sensibly.

It's fine to have one mixin method override another in its "public" interface,
but overriding a mixin's internal methods in its "protected" interface should
only happen under explicit extension.

e.g.
def simplyMixin(*classes):
  c = copy.copy(classes[0])
  c.__bases__ += classes[1:]
  return c()

class artist:
 def draw(self): ...
class cowboy:
 def draw(self): ...
 def drawAndShoot(): self.draw() ...
artisticCowboy = simplyMixin(artist, cowboy)()
artisticCowboy.draw() #draw a picture
artisticCowboy.drawAndShoot() #take out gun and fire it
)
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to