[PATCHES] reduce unnecessary imports in Python
nopower at suse.com
Thu Oct 25 14:58:16 UTC 2018
On 25/10/2018 00:05, Douglas Bagnall via samba-technical wrote:
> This is a very boring set of patches.
> In Python code we tend to import a lot of unnecessary modules. This sort
> of doesn't really matter, in that it just wastes time and memory and
> obfuscates what is really going on. Only sometimes will it cause a real bug.
> Since each individual unused import is such a tiny injury, it can feel
> silly to start fixing them, and after a short while that is indeed how I
> felt. This patchset is a measure of how far I got -- there are perhaps
> thousands more.
> It is difficult to know whether a python import is truly useless, as the
> import can have side-effects, deliberate or not. For example, "import
> samba.dckeytab" intentionally (and solely) has the effect of changing
> the behaviour of samba.net. This change is global, so if you import a
> module that somewhere imports samba.dckeytab, your samba.net.Net will
> change. It is lucky therefore that this patchset passes CI:
> To make things more interesting, a few of the patches introduce NEW
> imports, because it turns out we needed them.
RB+ pushed to autobuild with some others
More information about the samba-technical