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
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
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
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
>
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
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
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
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
>
> 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
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):
>>
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
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
"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
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:
---
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
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
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'
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
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
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
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
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
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
23 matches
Mail list logo