[Tutor] HELP: subclass of int

Shidai Liu shidai.liu at gmail.com
Tue Mar 8 23:10:11 CET 2005


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 be like this:
>>> I = my_int()
>>> I
5

Please, if you know a solution, help me out!

-- 
With best wishes!
Shidai


More information about the Tutor mailing list