lbates at swamisoft.com
Fri Jun 18 15:31:06 CEST 2004
I think you meant to write:
def __init__(self, array_type = "B"):
Note that your "default" got gobbled upwhen
array.array was looking for first argument
to be self.
"Gus Tabares" <gustabares at verizon.net> wrote in message
news:c42b7031.0406180524.2c5d91fc at posting.google.com...
> 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"):
> >>> 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.
More information about the Python-list