On Sun, Mar 20, 2016 at 8:44 PM, Ben Finney <[email protected]> wrote: > boB Stepp <[email protected]> writes:
>> Can I not use: >> >> if rng is None: >> rng = random.Random() > > That will work. > > It unfortunately creates a new random.Random instance every time that > line is executed, making the function waste a lot of time. Ah, I should have thought of that. Thanks! > So instead, you many want to create a module-level instance, and refer > to that as the default. I actually like this better anyway. At the moment I am focused on randint, but later on I am certain I will be other methods of the random module as this "fun" project develops. boB _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
