I would like to subclass datetime.date so that I can write:

d = date2('12312008')

I tried:

from datetime import date
class date2(date):
    def __init__( self, strng ):
        mm,dd,yy = int(strng[:2]), int(strng[2:4]), int(strng[4:])
        date.__init__(self,yy,mm,dd)

But then this statement:
d = date2('12312008')

Causes:
TypeError: function takes exactly 3 arguments (1 given)

Is there something basically wrong with subclassing date?
-Rick King
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to