![]() |
unused imports - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: Python (https://sinister.ly/Forum-Python) +--- Thread: unused imports (/Thread-unused-imports) |
unused imports - J4W3S - 03-31-2013 So i'm making a random encounter generator for a game i am making (isn't a good game just so i can learn python). But anyway i have a lot of unused imports for some reason does this effect performance at all? here is the code if it helps Code: import random unused imports - J4W3S - 03-31-2013 So i'm making a random encounter generator for a game i am making (isn't a good game just so i can learn python). But anyway i have a lot of unused imports for some reason does this effect performance at all? here is the code if it helps Code: import random RE: unused imports - ArkPhaze - 03-31-2013 Quick answer: No. And the way you have it is actually better for performance. If you had them all at the very top, importing is quick, but it is not without expense. Here you would be importing individually, instead of all at once. It would be like going to a store and just buying all the ingredients you think you might need, instead of making sure that you only grab what you need... Which would be more expensive? RE: unused imports - ArkPhaze - 03-31-2013 Quick answer: No. And the way you have it is actually better for performance. If you had them all at the very top, importing is quick, but it is not without expense. Here you would be importing individually, instead of all at once. It would be like going to a store and just buying all the ingredients you think you might need, instead of making sure that you only grab what you need... Which would be more expensive? RE: unused imports - J4W3S - 03-31-2013 oh ok thanks ![]() RE: unused imports - J4W3S - 03-31-2013 oh ok thanks ![]() RE: unused imports - ArkPhaze - 03-31-2013 They can be ignored if you are getting warnings here, because you don't want to use them all I'm assuming. RE: unused imports - ArkPhaze - 03-31-2013 They can be ignored if you are getting warnings here, because you don't want to use them all I'm assuming. |