Prev: Stop the Heat from Sun Rays!
Next: Call for papers (Deadline Extended): SETP-10, USA, July 2010
From: Ethan Furman on 27 Mar 2010 09:13 Wow. I just stumbled across one of Michele Simionato's offerings, called simple traits (strait for short) which looks *really* cool. You can find it here: http://pypi.python.org/pypi/strait/0.5.1 Extremely quick summary: Instead of multiple inheritance, with it's range of problems, use single inheritance for the basics, and include traits for various extra functionality that you want your class to have. As a side note, one of his blog entries at Artima talks about using composition instead of mixins when constructing a class, e.g. by doing: class foo(object): import baz def __init__(self): self.baz.do_something() which has the benefit (over mixins) of avoiding name-space pollution, as well as being able to tell where your methods are coming from. The cool thing (to me, at least) was the realization of being able to use import statements in class construction. Thanks, Michele!! ~Ethan~
|
Pages: 1 Prev: Stop the Heat from Sun Rays! Next: Call for papers (Deadline Extended): SETP-10, USA, July 2010 |