[Zope] OT: possibly... Comparing 2 blobs

Casey Duncan casey@zope.com
Fri, 28 Mar 2003 16:35:17 -0500


This Python script would be simple and fairly efficient in the common cas=
e=20
(assuming Zope Fileish objects):

##parameters=3Dfile1, file2
return file1.get_size() =3D=3D file2.get__size() or str(file1) =3D=3D str=
(file2)

It would only be inefficient for large files that were exactly the same s=
ize,=20
which would be uncommon methinks. To make that case efficient, you would =
need=20
to precompute a checksum at upload time and store it as a property for=20
comparison.

On Friday 28 March 2003 03:33 pm, Bobb wrote:
> Does anyone know of a "reliable" way to compare blobs in python / zope.=
=2E.=20
I'm looking a either comparing the first # of characters, or crc check or=
=20
something. =20
>=20
> TIA
>=20
> bobb