[Tutor] importing another classes's __init__

Christopher Spears cspears2002 at yahoo.com
Sun Feb 29 16:12:25 EST 2004

I am trying to make a class called UList based on the
class UserList.  This is an example of how UserList

>>> import UserList
>>> list = [1,2,3]
>>> a = UserList.UserList(list)
>>> a
[1, 2, 3]

This is the code I wrote for UList:

import UserList

class UList(UserList.UserList):
    def __init__(self, initlist=None):

When I tried the class out, I got:
>>> import UList
>>> list = [1,2,3]
>>> a = UList.UList(list)
>>> a

What gives?  I thought the line
UserList.UserList.__init__(self, initlist=None) would
import UserList's __init__ method.


More information about the Tutor mailing list