[egenix-users] comparing DateTime types
Steve Holden
sholden at holdenweb.com
Thu Feb 21 16:17:11 CET 2002
----- Original Message -----
From: "Max M" <maxm at mxm.dk>
To: "egenix-users" <egenix-users at lists.egenix.com>
Sent: Thursday, February 21, 2002 12:15 PM
Subject: [egenix-users] comparing DateTime types
> Hi
>
> This works as I expect:
> type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002))
> >>> 1
>
> But this doesn't:
> type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType)
> >>> 0
>
> Do I have to compare instances? I would have thought that comparing
with
> the "DateTimeType" directly would suffice.
>
>>> import mx.DateTime as dt
>>> dt.DateTimeType
<type 'DateTime'>
>>> type(dt.now())
<type 'DateTime'>
The magic you were looking for is probably
type(mx.DateTime.now()) == mx.DateTime.DateTimeType
The problem here is that type(mx.DateTime.DateTimeType) is a type, whose
type should therefore be typeType.
>>> type(dt.DateTimeType)
<type 'type'>
Hope this helps.
regards
Steve
--
Consulting, training, speaking: http://www.holdenweb.com/
Author, Python Web Programming: http://pydish.holdenweb.com/pwp/
"This is Python. We don't care much about theory, except where it
intersects with useful practice." Aahz Maruch on c.l.py
More information about the egenix-users
mailing list