[Python-Dev] Things to Know About Super (original) (raw)
Michele Simionato michele.simionato at gmail.com
Wed Aug 27 08:02:47 CEST 2008
- Previous message: [Python-Dev] Things to Know About Super
- Next message: [Python-Dev] Things to Know About Super
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, Aug 26, 2008 at 11:10 PM, Steve Holden <steve at holdenweb.com> wrote:
If you aren't aware of it you should take a look at Enthought's traits package. It's part of the Enthought Tool Suite (ETS).
I know of the existence of that framework, however it is quite large and I don't see the relation with the concept of traits I have in mind, which is more or less the one described here: http://www.iam.unibe.ch/%7Escg/Archive/Papers/Scha03aTraits.pdf
Basically, these are the properties of traits:
- the methods/attributes in a trait go logically together;
- if a trait enhances a class, then all subclasses are enhanced too;
- if a trait has methods in common with the class, then the methods defined in the class have the precedence;
- the ordering of traits is not important, i.e. enhancing a class first with trait T1 and then with trait T2 or viceversa is the same;
- if traits T1 and T2 have names in common, enhancing a class both with T1 and T2 raises an error unless there is an explicitoverriding;
- if a trait has methods in common with the base class, then the trait methods have the precedence;
Properties from 4 to 6 are the distinguishing properties of traits with respect to multiple inheritance and mixins.
- Previous message: [Python-Dev] Things to Know About Super
- Next message: [Python-Dev] Things to Know About Super
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]