On Sun, Jan 25, 2015 at 10:38 AM, Brian Gladman <no...@nowhere.net> wrote: > On 24/01/2015 23:22, Chris Angelico wrote: >> class RF(Fraction): >> def is_integer(self): >> return self.numerator % self.denominator == 0 > > Thanks for your help on this. I must admit that nowhere in a lot of > searching did I find that delegation is achieved by doing nothing!
Hehe :) If you want a technical look at it, what you have is the fundamental nature of subclassing: you derive from another class, and your class is identical to that with certain exceptions (in your case, an additional method). Python's way of handling that is called the Method Resolution Order or MRO, and you can find info on it on the web, eg: http://python-history.blogspot.com/2010/06/method-resolution-order.html Enjoy! ChrisA -- https://mail.python.org/mailman/listinfo/python-list