Am 30.04.2011 11:10 schrieb Matthias Kievernagel:

In my top-level script I want to select if my program
is to use random.xxx functions or the random.SystemRandom.xxx
ones.

On which criteria do you fix that?


Anyway, you could use a module myrandom.py:

import random

if use_sys:
    randobj = random.SystemRandom()
else:
    randobj = random.Random()

and then use

from myrandom import randobj as random

and then use random's methods (randrange, random, whatever), no matter where they come from.


Thomas
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to