Re: [Tutor] HELP: subclass of int

2005-03-08 Thread Kent Johnson
Shidai Liu wrote: Hi all, I'll sum up a question as following: def int5(): '''return 5''' return 5 class my_int(int): def __init__(self): self.id = int5() int.__init__(self, self.id) # FIXME: this line doesn't work the above code act like this: I = my_int() I 0 I want i

Re: [Tutor] HELP: subclass of int

2005-03-08 Thread Shidai Liu
On Tue, 8 Mar 2005 17:15:00 -0800 (PST), Terry Carroll <[EMAIL PROTECTED]> wrote: > On Tue, 8 Mar 2005, Shidai Liu wrote: > > > I'll sum up a question as following: > > > > def int5(): > > '''return 5''' > > return 5 > > > > class my_int(int): > > def __init__(self): > > self.

Re: [Tutor] HELP: subclass of int

2005-03-08 Thread Terry Carroll
On Tue, 8 Mar 2005, Shidai Liu wrote: > I'll sum up a question as following: > > def int5(): > '''return 5''' > return 5 > > class my_int(int): > def __init__(self): > self.id = int5() > int.__init__(self, self.id) # FIXME: this line doesn't work > > the above code

Re: [Tutor] HELP: subclass of int

2005-03-08 Thread jfouhy
Quoting Max Noel <[EMAIL PROTECTED]>: > I'm not absolutely confident with inheritance in Python (nearly all of > my serious OO work has been in Java), but shouldn't the call to the > superclass's constructor be the very first statement of the subclass's > constructor? No ... Or, well, ma

Re: [Tutor] HELP: subclass of int

2005-03-08 Thread Max Noel
On Mar 8, 2005, at 22:10, Shidai Liu wrote: Hi all, I'll sum up a question as following: def int5(): '''return 5''' return 5 class my_int(int): def __init__(self): self.id = int5() int.__init__(self, self.id) # FIXME: this line doesn't work I'm not absolutely confident

[Tutor] HELP: subclass of int

2005-03-08 Thread Shidai Liu
Hi all, I'll sum up a question as following: def int5(): '''return 5''' return 5 class my_int(int): def __init__(self): self.id = int5() int.__init__(self, self.id) # FIXME: this line doesn't work the above code act like this: >>> I = my_int() >>> I 0 I want it to