Is it just me, or do you also order your python imports by their lengths, for aesthetics?  | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Is it just me, or do you also order your python imports by their lengths, for aesthetics? 

For example, like this: import numpy as np import pandas as pd import seaborn as sns from collections import OrderedDict rather than like this: import seaborn as sns import numpy as np from collections import OrderedDict import pandas as pd Or are there specific conventions I'm not aware of (like the order of their usage in the code)? Just wondering..

10th Sep 2017, 4:07 PM
BossaNova
BossaNova - avatar
5 Answers
+ 10
Myself, I rather stack them up by theme.
10th Sep 2017, 8:11 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 5
@Testing003 Unless you leave it like this with a newline before y - no, it's valid.
11th Sep 2017, 6:24 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 3
Nah it's just a matter of personal preference
11th Sep 2017, 6:25 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 2
Isnt "from x import y" syntax error?
10th Sep 2017, 4:28 PM
Testing003
+ 2
@Testing003 No, it isn't, why would it be?
11th Sep 2017, 5:53 AM
Kuba Nawieśniak
Kuba Nawieśniak - avatar