Comment on Ask YC: Best practice for Python module imports?Comments−javert17yMy preference is to usefrom x import yinside any function that needs y.OTOH I think there are good reasons to go with the official Python recommendation, which another poster says states that all imports should be at the top on separate lines.
Comments
My preference is to use
from x import y
inside any function that needs y.
OTOH I think there are good reasons to go with the official Python recommendation, which another poster says states that all imports should be at the top on separate lines.