tip: itertools.repeat() is faster than range() for looping a fixed number of times when you don't need the loop variable.

min(random() for i in range(10_000)) # 1.03 msec per loop
min(random() for _ in repeat(None, 10_000)) # 841 usec per loop

Sign in to participate in the conversation

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!