Last active
December 24, 2015 16:39
-
-
Save habibutsu/6829354 to your computer and use it in GitHub Desktop.
Different way to import in pythons
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Varaian 1 | |
from package import module_with_some_name1, module_with_some_name2, \ | |
module_with_some_name3, module_with_some_name4, module_with_some_name5, \ | |
module_with_some_name6, module_with_some_name7 | |
# Variant 2 | |
from package import module_with_some_name1, \ | |
module_with_some_name2, \ | |
module_with_some_name3, \ | |
module_with_some_name4, \ | |
module_with_some_name5, \ | |
module_with_some_name6, \ | |
module_with_some_name7 | |
# Variant 2 (alternative) | |
from package import ( | |
module_with_some_name1, | |
module_with_some_name2, | |
module_with_some_name3, | |
module_with_some_name4, | |
module_with_some_name5, | |
module_with_some_name6, | |
module_with_some_name7 | |
) | |
""" | |
For example - if need to delete 'module_with_some_name2' for first variant | |
we must do following steps: | |
1. delete module | |
2. perform reformat of imports with several deletions and insertions | |
for second varian - just delete it | |
After deleting diff between changes in first variant hard to read because you must view the entire line of imports | |
Recommendation in PEP8 http://www.python.org/dev/peps/pep-0008/#imports | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment