Re: Question about inheritance...

2005-10-22 Thread Ron Adam
KraftDiner wrote: > Well here is a rough sketch of my code... > This is giving my two problems. > > 1) TypeError: super() argument 1 must be type, not classobj > 2) I want to be sure the the draw code calls the inherited classes > outline and not its own... > > class Shape: > def __init__(

Re: Question about inheritance...

2005-10-22 Thread Kent Johnson
KraftDiner wrote: > This is what I've got so far: > class Rect(Shape): > def __init__(self): > super(self.__class__, self).__init__() Should be super(Rect, self).__init__() > def render(self): > super(self.__class__, self).render() ditto In this exampl

Re: Question about inheritance...

2005-10-22 Thread Alex Martelli
KraftDiner <[EMAIL PROTECTED]> wrote: > Well here is a rough sketch of my code... > This is giving my two problems. > > 1) TypeError: super() argument 1 must be type, not classobj Make your classes new-style (have Shape inherit from object) to fix this. You're using the legacy (old-style) objec

Re: Question about inheritance...

2005-10-22 Thread KraftDiner
This is what I've got so far: class Shape(object): def __init__(self): pass def render(self): print 'Shape render' self.outline() def outline(self): pass class Rect(Shape): def __init__(self):

Re: Question about inheritance...

2005-10-22 Thread KraftDiner
Well here is a rough sketch of my code... This is giving my two problems. 1) TypeError: super() argument 1 must be type, not classobj 2) I want to be sure the the draw code calls the inherited classes outline and not its own... class Shape: def __init__(self): pass

Re: Question about inheritance...

2005-10-22 Thread Ron Adam
KraftDiner wrote: > I have a base class called Shape > And then classes like Circle, Square, Triangle etc, that inherit from > Shape: > > My quesiton is can a method of the Shape class call a method in Circle, > or Square etc...? This looks familiar. :-) Yes, it can if it has references to the

Re: Question about inheritance...

2005-10-22 Thread Mike Meyer
"KraftDiner" <[EMAIL PROTECTED]> writes: > I have a base class called Shape > And then classes like Circle, Square, Triangle etc, that inherit from > Shape: > > My quesiton is can a method of the Shape class call a method in Circle, > or Square etc...? Yup: >>> class Shape(object): ... def comm

Re: Question about inheritance...

2005-10-22 Thread Oliver Andrich
Hi, 22 Oct 2005 14:40:09 -0700, KraftDiner <[EMAIL PROTECTED]>: > I have a base class called Shape > And then classes like Circle, Square, Triangle etc, that inherit from > Shape: > > My quesiton is can a method of the Shape class call a method in Circle, > or Square etc...? even there would exis