Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Class decorators might also be super too

26 views
Skip to first unread message

Raymond Hettinger

unread,
May 28, 2011, 3:55:20 PM5/28/11
to
David Beazley wrote a class decorator blog post that is worth reading:
http://dabeaz.blogspot.com/2011/05/class-decorators-might-also-be-super.html

Raymond

Michele Simionato

unread,
May 29, 2011, 2:33:02 AM5/29/11
to
He is basically showing that using mixins for implementing logging is not such a good idea, i.e. you can get the same effect in a better way by making use of other Python features. I argued the same thing many times in the past. I even wrote a module once (strait) to reimplement 99% of multiple inheritance without multiple inheritance, just to show that in can be done in few lines of code in a language as powerful as Python.

Vinay Sajip

unread,
May 29, 2011, 7:29:06 AM5/29/11
to
On May 29, 7:33 am, Michele Simionato <michele.simion...@gmail.com>
wrote:
> He is basically showing that using mixins for implementingloggingis not such a good idea,

I don't think he was particularly advocating implementing logging this
way, but rather just using logging for illustrative purposes.

Regards,

Vinay Sajip

Raymond Hettinger

unread,
May 30, 2011, 12:27:37 AM5/30/11
to
On May 28, 11:33 pm, Michele Simionato <michele.simion...@gmail.com>
wrote:

> He is basically showing that using mixins for implementing logging is not such a good idea, i.e. you can get the same effect in a better way by making use of other Python features. I argued the same thing many times in the past. I even wrote a module once (strait) to reimplement 99% of multiple inheritance without multiple inheritance, just to show that in can be done in few lines of code in a language as powerful as Python.

More importantly, anyone who reads posts such as David' will walk away
with a deeper understanding of class decorators, mixins, and
inheritance. That makes the post worthwhile even if someone never
ends up using those particular coding technique.


Raymond

0 new messages