Comparing file objects: what is compared?
Fred L. Drake, Jr.
fdrake at acm.org
Fri Feb 11 13:09:33 EST 2000
Gerrit Holl writes:
> >>> fp1=open('/tmp/file_one', 'w')
> >>> fp2=open('/tmp/file_two', 'w')
> >>> cmp(fp1, fp2)
> -1
> >>> cmp(fp2, fp1)
> 1
>
> What is compared? The date of creation? The filename? The contents?
The ID is used for when nothing else is meaningful (and clear).
It's arbitrary & consistent. ;)
-Fred
--
Fred L. Drake, Jr. <fdrake at acm.org>
Corporation for National Research Initiatives
More information about the Python-list
mailing list