Help with modules/packages.
Christopher J. Bottaro
cjbottaro at alumni.cs.utexas.edu
Fri Dec 3 18:09:32 EST 2004
I want to be able to say stuff like "import CJB.ClassA" and "import
CJB.ClassB" then say "c = CJB.ClassA()" or "c = CJB.ClassB()". CJB will be
a directory containing files "ClassA.py" and "ClassB.py".
Now that I think about it, that can't work because Python allows you import
different things from the same module (file). If I said "import
CJB.ClassA", I'd have to instantiate ClassA like "c = CJB.ClassA.ClassA()".
I guess I could say "from CJB.ClassA import ClassA", but then I'd
instantiate like "c = ClassA()". What I really want is to say "c =
CJB.ClassA()"...is that possible?
Is my understand of modules/packages correct or am I way off?
Thanks for the help.
More information about the Python-list