[Tutor] HELP: subclass of int

Max Noel maxnoel_fr at yahoo.fr
Tue Mar 8 23:16:50 CET 2005

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 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 

-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, panting 
and sweating as you run through my corridors... How can you challenge a 
perfect, immortal machine?"

More information about the Tutor mailing list