dieter wrote: > "Ivan Evstegneev" <webmailgro...@gmail.com> writes: >> I have a question about "delegation" coding pattern(I'm working with >> Python 3.4). > > Unlike Java, Python supports "multiple inheritance". This means > that you need "delegation" much more rarely in Python. > Python does not have much special support for delegation: usually, > you must delegate explicitely - maybe using a delagating decorator.
You might *need* delegation more rarely, but some people believe that delegation and composition is a better design pattern than inheritance: http://learnpythonthehardway.org/book/ex44.html http://en.wikipedia.org/wiki/Composition_over_inheritance#Benefits http://joostdevblog.blogspot.com.au/2014/07/why-composition-is-often-better-than.html http://stackoverflow.com/questions/2068158/why-does-cocoa-use-delegates-rather-than-inheritance?lq=1 However, be warned that there are two subtly different models for delegation. Here's the one that people seem to forget: http://code.activestate.com/recipes/519639-true-lieberman-style-delegation-in-python/ -- Steven -- https://mail.python.org/mailman/listinfo/python-list