comparing datetime with date

Peter Hansen peter at
Wed Sep 15 03:00:42 CEST 2004

Graeme Matthew wrote:

> '2004-09-14 06:43:15'
> '2004-09-14'

> Even though there string values are different they still match?
> If we perform a CRC (Cyclic Redundancy Check) i.e compute a one way hash:
> import binascii
>>>>crc_x = binascii.crc32(str(x))
>>>>crc_y = binascii.crc32(str(y))
>>>>print crc_x == crc_y
> False
> So this confirms that there values do differ yet a comparision using ==
> returns True?

I'm unclear why you think this binascii.crc32 stuff has anything
to do with anything.  The strings are different, as you showed.

Ignoring collisions (which would be rare) two different strings
are going to have different CRC32 values.  Did you confuse yourself
somewhere along the way?

(Now if the CRC values for those two strings were the same, *that*
would indeed be interesting.)


More information about the Python-list mailing list