Greg Weeks weeks at
Sat Oct 6 06:56:31 CEST 2001

Greg Weeks (weeks at wrote:
: That's why you won't find me adding __cmp__ and __hash__ methods to bank
: accounts.

Having written the above, I was pleased to notice recently that for a file
object f:

    hash(f) == id(f)

So, just like Bank_accounts, file objects have the default hash function
and *can* be used as hash table keys.  So, in my slightly incendiary
phrasing, Python "got it right" for file objects.  Python, then, is sending
a mixed message.


More information about the Python-list mailing list