suppose I have a simple python project setup like this:
Project diectory
prog.py
pkg directory
__init__.py
mod1.py
class A:
In order to have class A (unqualified) available from prog.py, there are a
few options that I know about. I'm currently considering two of them and
would like some feedback on best practices.
1. in pkg.__init__.py add:
from pkg.mod1 import A
in prog.py add:
from pkg import A
2. leave __init__.py empty
in prog.py add:
from pkg.mod1 import A
Is there a preference or best practice that would indicate to prefer method
1 or method 2? Are there methods 3, 4, 5, ... that I should consider that
are even better?
--
Gerald Britton, MCSE-DP, MVP
LinkedIn Profile: http://ca.linkedin.com/in/geraldbritton
--
https://mail.python.org/mailman/listinfo/python-list