Subclassing array.array

Gus Tabares gustabares at verizon.net
Fri Jun 18 09:24:52 EDT 2004


Hello all,

I'm trying to subclass array.array but having problems with a default
parameter in the init constructor. Example:

    import array

    class TestClass(array.array):
        def __init__(self, array_type = "B"):
            array.array(array_type)


>>> temp = TestClass()
Traceback (most recent call last):
  File "<pyshell#1>", line 1, in ?
    temp = TestClass()
TypeError: array() takes at least 1 argument (0 given)

I think there is something that I'm not understanding here. Any help
is appreciated.


Thanks,
Gus



More information about the Python-list mailing list