[PATCHES] reduce unnecessary imports in Python
douglas.bagnall at catalyst.net.nz
Wed Oct 24 23:05:52 UTC 2018
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
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 39992 bytes
Desc: not available
More information about the samba-technical