Greetings *.*: The following program caused an error and puzzled me to no end. Any help immensely appreciated.
(Thanks)^2 - Yet Another Dummy Python User (Python version: Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on win32 ) ------------------------------------------------------------------------------------------- from datetime import date #------------------------------------------------------------ class First(date): def __init__(self, y, m, d): date.__init__(self, y, m, d) class Second(First): def __init__(self, datestr): y = int(datestr[0:4]) m = int(datestr[4:6]) d = int(datestr[6:8]) First.__init__(self, y, m, d) #------------------------------------------------------------ class One(object): def __init__(self, y, m, d): self.y = y self.m = m self.d = d class Two(One): def __init__(self, datestr): y = int(datestr[0:4]) m = int(datestr[4:6]) d = int(datestr[6:8]) One.__init__(self, y, m, d) #------------------------------------------------------------ # Do this and you get an error: # a = Second("20060201") # TypeError: function takes exactly 3 arguments (1 given) # Why? a = Second("20060201") print a #------------------------------------------------------------ # By comparison, do this and there's no error. b = Two("20060301") print b
-- http://mail.python.org/mailman/listinfo/python-list