On 2005-02-14, Steven Bethard <[EMAIL PROTECTED]> wrote:
> Grant Edwards wrote:
>> Is it true that a datetime object can convert itself into a
>> string, but not the other way around?  IOW, there's no simple
>> way to take the output from str(d) and turn it back into d?
>
> I assume this is true because there is not one standard format
> for a date-time string.

There seems to be a de-facto standard format: that which is
returned by the str(d).

>> class MyDatetime(datetime.datetime):
>>     def __init__(self,s):
[...]

> datetime.datetime objects are immutable, so you need to define
> __new__ instead of __init__:

Thanks. I should have known that. I guess I've never subclassed
an immutible type before.

-- 
Grant Edwards                   grante             Yow!  It's hard being
                                  at               an ARTIST!!
                               visi.com            
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to