In random.py (Python 2.5.1), line 86 says: VERSION = 2 # used by getstate/setstate Then, in the definition of Random.setstate, we have: if version == 2: Why is it not: if version == self.VERSION: