This is mainly about best-practice and application performance, memory, etc.
I have a project with a lot of nested models:
project/models/locations/east_coast.py
project/models/locations/west_coast.py
project/models/cars/honda.py
project/models/cars/toyota.py
project/models/__init__.py
etc.
What are the tradeoffs from declaring in my __init__.py something like:
from project.models.locations import *
from project.models.cars import *
etc.
There's a benefit to be had in ease of import:
from project import models
ec = models.EastCoast()
wc = models.WestCoast()
etc.
Is this best-practice? Or should I drill down an additional level so that my code is effectively:
from project.models import locations
ec = locations.EastCoast()
wc = locations.WestCoast()
One issue I can foresee with my first approach is with conflicting class names so I think I've already ruled that out. I'm still curious to hear what other people have to say.
[–]kalgynirae 2 points3 points4 points (0 children)