Re: refering to base classes

2006-08-30 Thread Jan Niklas Fingerle
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > I suppose "this" refers to the use of super() ? If so, I wouldn't say > it's "superior", but it can be helpful with complex inheritence scheme ... which aren't anywhere in sight. Don't start using super() until you need diamond shape inheritance (n

Re: refering to base classes

2006-08-30 Thread Chaz Ginger
Georg Brandl wrote: > Chaz Ginger wrote: >> glenn wrote: Shouldn't that be beagle = animal.dog() to create an instance? We've all done it ... >>> lol - actually Im confused about this - there seem to be cases where >>> instantiaing with: >>> instance=module.classn

Re: Naming conventions (was: Re: refering to base classes)

2006-08-30 Thread Neil Cerutti
On 2006-08-30, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > On Wed, 30 Aug 2006 14:22:16 +1000, Ben Finney <[EMAIL PROTECTED]> wrote: >>"glenn" <[EMAIL PROTECTED]> writes: >> >>> Bruno Desthuilliers wrote: >>> > It might be better to use newstyle classes if you can. Also, the >>> > convention i

Re: refering to base classes

2006-08-30 Thread Georg Brandl
Chaz Ginger wrote: > glenn wrote: >>> Shouldn't that be >>> >>> beagle = animal.dog() >>> >>> to create an instance? >>> >>> We've all done it ... >> lol - actually Im confused about this - there seem to be cases where >> instantiaing with: >> instance=module.classname() >> gives me an error, but >

Re: refering to base classes

2006-08-30 Thread Bruno Desthuilliers
glenn wrote: >>> Bruno Desthuilliers wrote: >> >> http://www.python.org/download/releases/2.2.3/descrintro/#mro > thanks - interesting essay/article - a lot in their I've never really > considered - though its only recently ive started playing with multiple > inheritance in any context - thanks f

Re: refering to base classes

2006-08-30 Thread Bruno Desthuilliers
glenn wrote: >> Shouldn't that be >> >> beagle = animal.dog() >> >> to create an instance? >> >> We've all done it ... > lol - actually Im confused about this - there seem to be cases where > instantiaing with: > instance=module.classname() > gives me an error, but > instance=module.classname > doe

Re: refering to base classes

2006-08-30 Thread Chaz Ginger
glenn wrote: >> Shouldn't that be >> >> beagle = animal.dog() >> >> to create an instance? >> >> We've all done it ... > lol - actually Im confused about this - there seem to be cases where > instantiaing with: > instance=module.classname() > gives me an error, but > instance=module.classname > doe

Re: refering to base classes

2006-08-30 Thread glenn
thanks - interesting essay/article - a lot in their I've never really considered - though its only recently ive started playing with multiple inheritance in any context - thanks for that Bruno Desthuilliers wrote: > glenn wrote: > > Bruno Desthuilliers wrote: > > > (snip) > >> > >> Here you could

Re: refering to base classes

2006-08-30 Thread glenn
> > Shouldn't that be > > beagle = animal.dog() > > to create an instance? > > We've all done it ... lol - actually Im confused about this - there seem to be cases where instantiaing with: instance=module.classname() gives me an error, but instance=module.classname doesnt - so I got into that habit

Re: refering to base classes

2006-08-30 Thread Bruno Desthuilliers
glenn wrote: > Bruno Desthuilliers wrote: > (snip) >> >> Here you could use a class attribute to provide a default: >> >> class Creature(object): >> noise = "" >> >> def voice(self): >> return "voice:" + self.noise >> >> >> class Dog(Creature): >> noise="bark" >> >> def voice(self): >>

Re: refering to base classes

2006-08-29 Thread Steve Holden
glenn wrote: > Hi Roberto > >>If you want dog.voice() to just print "voice: bark", you just have to omit >>the voice method for the dog class: it will be inherited from creature. >> > > I would have thought this would be correct, but in this case, plus in > others im playin with, I get this issue

Re: Naming conventions (was: Re: refering to base classes)

2006-08-29 Thread Jean-Paul Calderone
On Wed, 30 Aug 2006 14:22:16 +1000, Ben Finney <[EMAIL PROTECTED]> wrote: >"glenn" <[EMAIL PROTECTED]> writes: > >> Bruno Desthuilliers wrote: >> > It might be better to use newstyle classes if you can. Also, the >> > convention is to use CamelCase for classes names (unless you have >> > a strong r

Naming conventions (was: Re: refering to base classes)

2006-08-29 Thread Ben Finney
"glenn" <[EMAIL PROTECTED]> writes: > Bruno Desthuilliers wrote: > > It might be better to use newstyle classes if you can. Also, the > > convention is to use CamelCase for classes names (unless you have > > a strong reason to do otherwise). Note that this style is more correctly called TitleCase

Re: refering to base classes

2006-08-29 Thread glenn
Hi Roberto > If you want dog.voice() to just print "voice: bark", you just have to omit > the voice method for the dog class: it will be inherited from creature. > I would have thought this would be correct, but in this case, plus in others im playin with, I get this issue: ---

Re: refering to base classes

2006-08-29 Thread glenn
Bruno Desthuilliers wrote: > glenn wrote: > > hi - Im quite new to python, wondering if anyone can help me understand > > something about inheritance here. In this trivial example, how could I > > modify the voice method of 'dog' to call the base class 'creatures' > > voice method from with in i

Re: refering to base classes

2006-08-29 Thread glenn
Chaz Ginger wrote: > Chaz Ginger wrote: > > glenn wrote: > >> hi - Im quite new to python, wondering if anyone can help me understand > >> something about inheritance here. In this trivial example, how could I > >> modify the voice method of 'dog' to call the base class 'creatures' > >> voice me

Re: refering to base classes

2006-08-29 Thread Chaz Ginger
Jason wrote: > Chaz Ginger wrote: >> Chaz Ginger wrote: >>> glenn wrote: hi - Im quite new to python, wondering if anyone can help me understand something about inheritance here. In this trivial example, how could I modify the voice method of 'dog' to call the base class 'creatures'

Re: refering to base classes

2006-08-29 Thread Jason
Chaz Ginger wrote: > Chaz Ginger wrote: > > glenn wrote: > >> hi - Im quite new to python, wondering if anyone can help me understand > >> something about inheritance here. In this trivial example, how could I > >> modify the voice method of 'dog' to call the base class 'creatures' > >> voice meth

Re: refering to base classes

2006-08-29 Thread Bruno Desthuilliers
glenn wrote: > hi - Im quite new to python, wondering if anyone can help me understand > something about inheritance here. In this trivial example, how could I > modify the voice method of 'dog' to call the base class 'creatures' > voice method from with in it? > > class creature: > def __ini

Re: refering to base classes

2006-08-29 Thread Roberto Bonvallet
glenn wrote: > [...] In this trivial example, how could I modify the voice method of > 'dog' to call the base class 'creatures' voice method from with in it? > > class creature: >def __init__(self): >self.noise="" >def voice(self): >return "voice:" + self.noise > > class

Re: refering to base classes

2006-08-29 Thread Chaz Ginger
Chaz Ginger wrote: > glenn wrote: >> hi - Im quite new to python, wondering if anyone can help me understand >> something about inheritance here. In this trivial example, how could I >> modify the voice method of 'dog' to call the base class 'creatures' >> voice method from with in it? >> >> class

Re: refering to base classes

2006-08-29 Thread Chaz Ginger
glenn wrote: > hi - Im quite new to python, wondering if anyone can help me understand > something about inheritance here. In this trivial example, how could I > modify the voice method of 'dog' to call the base class 'creatures' > voice method from with in it? > > class creature: > def __ini

refering to base classes

2006-08-29 Thread glenn
hi - Im quite new to python, wondering if anyone can help me understand something about inheritance here. In this trivial example, how could I modify the voice method of 'dog' to call the base class 'creatures' voice method from with in it? class creature: def __init__(self): self.noi