Question: In python, Is it wise to use the imports from your sub classes, or does it matter?
Info:
So, I have a program split up over 6 files. in almost every one of the .py files i import threading, socket, and pickle. What I’m wondering is this, is there an efficiency difference between:
File1.py:
import socket
File2.py:
import File1
import socket
and this:
File2.py:
import File1
from File1 import socket
Or even this:
File2.py
import File1
socket = File1.socket
Don’t use
from File1 import socket. It doesn’t make a performance difference, but it gives headaches to other people having to look in the other file to see thatFile1.socketis actuallysocket, and it might get messy if you decide you don’t needsocketinFile1.Also, this is against the python principles because: