Daily Shaarli

All links of one day in a single page.

March 9, 2019

Micro-optimization for random.choices(). Convert range() to repeat(). · Issue #11889 · python/cpython
thumbnail

Borrowing from the technique used in the timeit module, loop with repeat() instead of range() to avoid unnecessary creation and destruction of integer objects. Gives a modest speed-up (in the 5% r...

How To Add Custom Build Steps and Commands To setup.py

A setup.py script using distutils / setuptools is the standard way to package Python code. Often, however, we need to perform custom actions for code generation, running tests, profiling, or building documentation, etc., and we’d like to integrate these actions into setup.py. In other words, we’d like...