bambam a écrit : > "Bruno Desthuilliers" <[EMAIL PROTECTED]> > wrote in message news:[EMAIL PROTECTED] >> As a side note, in Python, inheritance ... >> ... should usually not be used for typing. > > :~( > I'm sorry, I don't even know what that means... The code I > have inherited from someone only a little more knowledgeable > than me, and is still full of development artifacts anyway. > > The Pwr and Psp classes inherit from the Device class not > neccessarily because that is a Good Thing, more because > the development process led to them being thought of that > way. All devices have a mixture of common and differing > attributes. > > What is 'typing'? >
Mmm... Most CS experts don't really agree on this, and I'm certainly not one (expert). So I won't even try to explain it by myself, and let you google for "type system", "static typing", "dynamic typing", "duck typing" etc... Now what I meant here is that in Python, you don't have to make class B inherit from class A to let you use an instance of B where an instance of A was expected - all you need is that both objects share the set of attributes and methods you're going to use. Inheritence is only useful for sharing common code. HTH -- http://mail.python.org/mailman/listinfo/python-list