diff options
author | Raymond Hettinger <python@rcn.com> | 2003-01-07 10:25:55 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2003-01-07 10:25:55 (GMT) |
commit | 145a4a0f10009f7ce2644465ccd359938b034ac4 (patch) | |
tree | 4469a0891a248165a1d76701a76fdb2e51972e01 /Lib/random.py | |
parent | a9cfa5501ff956197e011361cbd8b04d47adcfa8 (diff) | |
download | cpython-145a4a0f10009f7ce2644465ccd359938b034ac4.zip cpython-145a4a0f10009f7ce2644465ccd359938b034ac4.tar.gz cpython-145a4a0f10009f7ce2644465ccd359938b034ac4.tar.bz2 |
Much clearer when super() is used.
Diffstat (limited to 'Lib/random.py')
-rw-r--r-- | Lib/random.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/random.py b/Lib/random.py index ccac440..3db1f1a 100644 --- a/Lib/random.py +++ b/Lib/random.py @@ -58,9 +58,9 @@ SG_MAGICCONST = 1.0 + _log(4.5) # Adrian Baddeley. Adapted by Raymond Hettinger for use with # the Mersenne Twister core generator. -from _random import Random as CoreGenerator +import _random -class Random(CoreGenerator): +class Random(_random.Random): """Random number generator base class used by bound module functions. Used to instantiate instances of Random to get generators that don't @@ -94,19 +94,19 @@ class Random(CoreGenerator): If a is not None or an int or long, hash(a) is used instead. """ - CoreGenerator.seed(self, a) + super(Random, self).seed(a) self.gauss_next = None def getstate(self): """Return internal state; can be passed to setstate() later.""" - return self.VERSION, CoreGenerator.getstate(self), self.gauss_next + return self.VERSION, super(Random, self).getstate(), self.gauss_next def setstate(self, state): """Restore internal state from object returned by getstate().""" version = state[0] if version == 2: version, internalstate, self.gauss_next = state - CoreGenerator.setstate(self, internalstate) + super(Random, self).setstate(internalstate) else: raise ValueError("state with version %s passed to " "Random.setstate() of version %s" % |