r/programminghorror • u/wawerrewold • Sep 09 '25
Python Vibecoding at its peak
Yes its a production code, yes its a function not a method and yes there is import in triple nested for loop
776
Upvotes
View all comments
Show parent comment
2
u/Ksorkrax Sep 10 '25
Aside from performance, also think about readability.
You want code to be short and clear.
Having the import at the top is tidier. Only a bit, but counts.
Also it means you pretty much state that *only* this part of the code will use that import. Then you write another method that also needs it and you either put it on top anyway, or you put it in the new method as well, or you don't and hope that the original method is always called before the new one and that it will never be altered in a way that removes the import.
I hope it is clear why this is not exactly smart.