Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
beginner, idomatic python 2
- From: bruno.42.desthuilliers at wtf.websiteburo.oops.com (Bruno Desthuilliers)
- Subject: beginner, idomatic python 2
- Date: Fri, 31 Aug 2007 10:49:56 +0200
bambam a ?crit : > "Bruno Desthuilliers" <bruno.42.desthuilliers at wtf.websiteburo.oops.com> > wrote in message news:46d2ba7a$0$430$426a74cc at news.free.fr... >> 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
- References:
- beginner, idomatic python 2
- From: bambam
- beginner, idomatic python 2
- From: Dan Bishop
- beginner, idomatic python 2
- From: bambam
- beginner, idomatic python 2
- From: Bruno Desthuilliers
- beginner, idomatic python 2
- From: bambam
- beginner, idomatic python 2
- Prev by Date: Do you have any complete example for creating msi file(doing file copying)
- Next by Date: status of Programming by Contract (PEP 316)?
- Previous by thread: beginner, idomatic python 2
- Next by thread: beginner, idomatic python 2
- Index(es):