[egenix-users] comparing DateTime types

Jim Vickroy Jim.Vickroy at noaa.gov
Thu Feb 21 10:26:03 CET 2002


Hello Max,
 I'm using Python 2.2 and here is the behavior:

>>> import mx.DateTime
>>> type(mx.DateTime.now())
<type 'DateTime'>
>>> type(mx.DateTime.DateTimeType)
<type 'type'>
>>> mx.DateTime.DateTimeType
<type 'DateTime'>
>>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType
1
>>>

Note that the type of DateTimeType is 'type' which is as expected -- the
type of a type is 'type'.

Max M wrote:

> 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.
>
> regards Max M
>
> _______________________________________________________________________
> eGenix.com User Mailing List                     http://www.egenix.com/
> http://lists.egenix.com/mailman/listinfo/egenix-users




More information about the egenix-users mailing list