3 ms·
Within each grouping, imports should be sorted lexicographically, ignoring case, according to each module's full package path. import foo from foo import b
by sigzero 17y ago
Within each grouping, imports should be sorted lexicographically, ignoring case, according to each module's full package path.
import foo
from foo import bar
from foo.bar import baz
from foo.bar import Quux
from Foob import ar
That seems kind of time consuming...
- etal 17y agoSome text editors have a function for sorting text in-place. Vim does, and I assume Emacs does too. Sorting makes it easier to recognize a common grouping of imports (e.g. some recurring functionality that requires three particular modules) without inspecting the words carefully.
- endgame 17y agoEmacs: M-x sort-lines