You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import array
import os
import re
from datetime import datetime
from os.path import join
from zipfile import ZipFile
Current output:
import array
import os
import re
from datetime import datetime
from os.path import join
from zipfile import ZipFile
Desired output:
import array
from datetime import datetime
import os
from os.path import join
import re
from zipfile import ZipFile
This gives a concrete advantage:
All references to a particular package are in a single, specific place, regardless of import style.
This makes working with the code slightly easier: When refactoring, finding all imports of a package requires just one alphabetical search. When reviewing patches, changes to a particular package will be confined to a single diff-block, even if the import style changes.
There's prior art in the openstack style guide. Most other style guides are either ambiguous or completely unspecified on this fine point. What's more, the "Desired" block passes one of the pylint checks, while the "Current" doesn't.
Most importantly though, this accords with my intuition. I feel it has the same driving force as our trailing-comma policy; among essentially-equal formattings, pick the one that provides the lowest barrier to refactoring.
I'll implement the change if we can agree on the policy.
The text was updated successfully, but these errors were encountered:
Input:
Current output:
Desired output:
This gives a concrete advantage:
This makes working with the code slightly easier: When refactoring, finding all imports of a package requires just one alphabetical search. When reviewing patches, changes to a particular package will be confined to a single diff-block, even if the import style changes.
There's prior art in the openstack style guide. Most other style guides are either ambiguous or completely unspecified on this fine point. What's more, the "Desired" block passes one of the pylint checks, while the "Current" doesn't.
Most importantly though, this accords with my intuition. I feel it has the same driving force as our trailing-comma policy; among essentially-equal formattings, pick the one that provides the lowest barrier to refactoring.
I'll implement the change if we can agree on the policy.
The text was updated successfully, but these errors were encountered: