Paulo da Silva a écrit :
(snip)

Not an answer to your question, just a couple advices:

> from datetime import date
> import cPickle,string

The string module is mostly deprecated. You should use str type methods 
whenever possible (cf below)

> class MyDate(date):
>       def __new__(cls,year,month=None,day=None):
>               if type(year) is str:

And what if it's a unicode string ?
The correct idiom here is:
                  if isinstance(year, basestring):

>                       year,month,day=map(int,string.split(year,'-'))
                         year, month, day = map(int, year.split('-'))

>               if year < 100:
>                       year += 2000
>               return date.__new__(cls,year,month,day)
> 
(snip)
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to