Modules are hashable?!

Leif K-Brooks eurleif at ecritters.biz
Wed Sep 1 09:49:03 CEST 2004


I was just playing around, and noticed that modules seem to be hashable. 
Can anyone explain that, especially given the fact that they're mutable?

Python 2.3.3 (#1, May  7 2004, 10:31:40)
[GCC 3.3.3 20040412 (Red Hat Linux 3.3.3-7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import sys
 >>> hash(sys)
-150589324
 >>> sys.x = 42
 >>> hash(sys)
-150589324
 >>> foo = {sys:'bar'}
 >>> foo[sys]
'bar'



More information about the Python-list mailing list