Comparing file objects: what is compared?

Gerrit Holl gerrit.holl at pobox.com
Fri Feb 11 10:51:55 EST 2000


Hello,

>>> 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?

I've searched the FAQ, the documentation, the sig archives and the
newsgroup, but I'm not able to find the answer. What is compared when
comparing file objects?

regards,
Gerrit.

-- 
Homepage: http://www.nl.linux.org/~gerrit
-----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com
Version: 3.12
GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O
!M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y
-----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth




More information about the Python-list mailing list